Simple Coding Help - No Promise.

dell

Well-Known Member
Buy = <condition for buy> ;
Short = <condition for short> ;

add1 = <cond for add1> ;
add2 = <cond for add2> ;

coverpar = <part exit for short> ;
sellpar = <part exit for buy> ;

Cover = <exit for short> ;
Sell = <exit for Buy> ;

if condition is such that multiple bars gives signal like say MACD > 0 will be satisfied for all bars as long as above zero, then duplicates can be removed upto a particular condition using ExRem like

Cover = Exrem(Cover, Short) ;
Sell = Exrem(Sell, Buy) ;

Buy = Exrem(Buy, Short or Sell or Sellpar) ;
Short = Exrem(Short, Buy or Cover or Coverpar) ;

and so forth....

not sure if this is what you wanted.
thank u very much , pratap sir , since from tsf i am getting help from u (all of u r really helping hands ),
this is same structure i needed ...............
here for adding on buy side we write ....add1 .....add2 etc .........for sell them partially r we writting sellpar1 ,sellpar2 ?

and for adding in selling what we write ? is it same add1 ......add2 ..? and coverpar1...coverpar2 ?
 

pratapvb

Well-Known Member
only Buy, Short, Sell, Cover are Ami variables that one uses....others are whatever we name and is just variables as part of our code.
 

dell

Well-Known Member
only Buy, Short, Sell, Cover are Ami variables that one uses....others are whatever we name and is just variables as part of our code.
pratap sir , is this is a correct way ; or it needs some modification (on ur free time plz check this is in correct order for backtesting ?as in short position we have three add but only two cover condition's) ?

Buy=Cross(C,eh);
add1=Cross(a,e)AND m1>s1;
add2=Cross(C,k);
add3=trend==1;

Sell=Cross(el,C);
Sellpar1=Cross(e,a);
Sellpar2=Cross(s1,m1);
Sellpar3=trend==-1;

Short=Cross(el,C);
add1=Cross(e,a);
add2=Cross(s1,m1);
add3=trend==-1;

Cover=Cross(C,eh);
Coverpar1=Cross(m1,s1) ;
coverpar2=trend==1;

also sir , if needed than can post whole afl here ,
 
Last edited:

pratapvb

Well-Known Member
pratap sir , is this is a correct way ; or it needs some modification (on ur free time plz check this is in correct order for backtesting ?as in short position we have three add but only two cover condition's) ?

Buy=Cross(C,eh);
add1=Cross(a,e)AND m1>s1;
add2=Cross(C,k);
add3=trend==1;

Sell=Cross(el,C);
Sellpar1=Cross(e,a);
Sellpar2=Cross(s1,m1);
Sellpar3=trend==-1;

Short=Cross(el,C);
add1=Cross(e,a);
add2=Cross(s1,m1);
add3=trend==-1;

Cover=Cross(C,eh);
Coverpar1=Cross(m1,s1) ;
coverpar2=trend==1;

also sir , if needed than can post whole afl here ,
not too good at automated backtesting / exploration....had investigated...found too many limitations...so abandoned it
 
Last edited:

manojborle

Well-Known Member


Uploaded with ImageShack.us

Can somebody help me in writing a scan ?
As shown in the chart, the area marked with rectangle, almost all the EMA's which can be seen in title are very much near.
In this case, 20 EMA = 5961.28
15 min 20 EMA = 5959.14
30 min 20 EMA = 5961.11
Hourly 20 EMA = 5958.77

So I want to scan stocks in my watch list meeting the above condition and want to run this scan every 5 minutes.

Thanks for the help in advance.

Manoj
 
Last edited:

dell

Well-Known Member
what is correct way of maintaning database ?
earlier i make two seperate database for eod and ieod .
and seperately for ncdex , mcx and fno ........

is it is right way ?

or i have to make a database in which eod and ieod data will merge and make three different watchlist named mcx , ncdex and fno ?
 
SetChartOptions(0,chartShowArrows|chartShowDates);
Color = SM_TrendBars(ColorRGB(0,191,255), colorRed,colorGrey50);
Plot( C, "Price", Color, styleCandle | styleThick );
j=SM_WP();
SL = SM_NW(j,1,2);

P1 = Param("Conversion Period", 9, 2, 200, 1, 0);
C1 = ParamColor("Conversion Color", colorBlue);
CL = (HHV(H,P1)+LLV(L,P1))/2;

P2 = Param("Base Period", 26, 2, 200, 1, 0);
C2 = ParamColor("Base Color", colorRed);
BL = (HHV(H,P2)+LLV(L,P2))/2;

C3 = ParamColor("Leading A Color", colorBrightGreen);
LSA = (CL+BL)/2;

P4 = Param("Leading B Span", 52, 2, 200, 1, 0);
C4 = ParamColor("Leading B Color", colorPink);
LSB = (HHV(H,P4)+LLV(L,P4))/2;

P3 = Param("Leading Span Displacement", 26, 2, 200, 1, 0);

P5 = Param("Lagging Displacement", -26, 2, 200, 1, 0);
C5 = ParamColor("Lagging Color", colorGreen);

Plot(CL,"Tenkan-sen (Conversion Line)", C1, styleLine);
Plot(BL, "Kijun-sen (Base Line)", C2, styleLine);
Plot(LSA, "Senkou Span A (Leading Span A)", C3, styleLine, 0, 0, P3);
Plot(LSB, "Senkou Span B (Leading Span B)", C4, styleLine, 0, 0, P3);
Plot(C, "Chikou Span (Lagging Span)", C5, styleLine, 0, 0, P5);
PlotOHLC (LSA,LSA,LSB,LSB,"Cloud",IIf(LSA>LSB,ColorBlend(C3, colorWhite, 0.6),
ColorBlend(C4,colorWhite, 0.4)),styleCloud, 0, 0, P3);




happy or pratap can u pls put buy & sell condition as under:-
1buy if price is above cloud &
2cl(tankensen) crosses bl(kijun sen) & pointing upwards
vice versa for sell
will be of immense help.
 

manojborle

Well-Known Member
what is correct way of maintaning database ?
earlier i make two seperate database for eod and ieod .
and seperately for ncdex , mcx and fno ........

is it is right way ?

or i have to make a database in which eod and ieod data will merge and make three different watchlist named mcx , ncdex and fno ?
Maintaining a Separate database is the right way.
 

Cubt

Algo Trader
Happy_Singh,
I have a question, currently I have js script which takes the screen shot of current active chart window. But if I have 3 charts window open, I want to take screen shot of all 3 charts from amibroker. How do we do that?
 

Similar threads