help needed for this afl

#1
hi
i want an afl for this particular strategy
buy on 3/15 ema crossover on 30 mins chart and exit if profit = 10points
or if current price is less than low of the candle on which crossover took place.
thanks in advance :)
 

johnnypareek

Well-Known Member
#4
some one please help.
really need to develop this system.
i guess it will help u.

HTML:
TimeFrameSet(6* in5Minute ); // switch to 30 minute frame 

EMA3=EMA(C,3);
EMA15=EMA(C,15);
_N(Title = StrFormat("{{NAME}} - {{30 MINUTE}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot( C, "Close", ParamColor("Color", colorBlack ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() ); 
Plot(EMA3,"30 min 3 EMA",4,1);
Plot(EMA15,"30 min 15 EMA",5,1);

bcon=Cross(EMA3,EMA15);
BCON2=ValueWhen(Cross(EMA3,EMA15),H,1);
BCON3=Hold(BCON2,5);
Buy= BCON AND H>BCON3;

Scon=Cross(EMA15,EMA3);
SCON2=ValueWhen(Cross(EMA15,EMA3),L,1);
SCON3=Hold(SCON2,5);
Sell=SCON;// AND L<SCON3;

Buy=ExRem(Buy,Sell);
Sell=ExRem(Sell,Buy);
trigger=IIf(Buy,bcon2,IIf(Sell,scon2,Null));
Plot(trigger,"trigger",4,1);
shape = Buy * shapeUpArrow + Sell * shapeDownArrow;
PlotShapes( shape, IIf( Buy, colorGreen, colorRed ),0, IIf( Buy, Low, High ) );
TimeFrameRestore(); // restore time frame to original

johnnypareek at yahoo.com
 
#5
i guess it will help u.

HTML:
TimeFrameSet(6* in5Minute ); // switch to 30 minute frame 

EMA3=EMA(C,3);
EMA15=EMA(C,15);
_N(Title = StrFormat("{{NAME}} - {{30 MINUTE}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot( C, "Close", ParamColor("Color", colorBlack ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() ); 
Plot(EMA3,"30 min 3 EMA",4,1);
Plot(EMA15,"30 min 15 EMA",5,1);

bcon=Cross(EMA3,EMA15);
BCON2=ValueWhen(Cross(EMA3,EMA15),H,1);
BCON3=Hold(BCON2,5);
Buy= BCON AND H>BCON3;

Scon=Cross(EMA15,EMA3);
SCON2=ValueWhen(Cross(EMA15,EMA3),L,1);
SCON3=Hold(SCON2,5);
Sell=SCON;// AND L<SCON3;

Buy=ExRem(Buy,Sell);
Sell=ExRem(Sell,Buy);
trigger=IIf(Buy,bcon2,IIf(Sell,scon2,Null));
Plot(trigger,"trigger",4,1);
shape = Buy * shapeUpArrow + Sell * shapeDownArrow;
PlotShapes( shape, IIf( Buy, colorGreen, colorRed ),0, IIf( Buy, Low, High ) );
TimeFrameRestore(); // restore time frame to original

johnnypareek at yahoo.com
thanks a ton man :thumb::clap::clap:
just 2 more small things, if u could modify them.
first that it should take trades only if at crossover , the difference between both ema's is atleast 1 point and second that it should not enter trades if difference between low(high in case of bear crossover) of candle and close on which crossover took place is more than 50 points.
 
Last edited:

johnnypareek

Well-Known Member
#6
thanks a ton man :thumb::clap::clap:
just 2 more small things, if u could modify them.
first that it should take trades only if at crossover , the difference between both ema's is atleast 1 point and second that it should not enter trades if difference between low(high in case of bear crossover) of candle and close on which crossover took place is more than 50 points.
hope this will work
HTML:
TimeFrameSet(6* in5Minute ); // switch to 30 minute frame 

EMA3=EMA(C,3);
EMA15=EMA(C,15);
_N(Title = StrFormat("{{NAME}} - {{30 MINUTE}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot( C, "Close", ParamColor("Color", colorBlack ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() ); 
Plot(EMA3,"30 min 3 EMA",4,1);
Plot(EMA15,"30 min 15 EMA",5,1);

bcon=Cross(EMA3,EMA15) AND (EMA3-EMA15) > 1 AND C-L < 50;
BCON2=ValueWhen(Cross(EMA3,EMA15),H,1);
BCON3=Hold(BCON2,5);
Buy= BCON AND H>BCON3;

Scon=Cross(EMA15,EMA3);
SCON2=ValueWhen(Cross(EMA15,EMA3),L,1);
SCON3=Hold(SCON2,5);
Sell=SCON;// AND L<SCON3;
Short=Cross(EMA15,EMA3) AND (EMA15-EMA3) > 1 AND H-C < 50;
Cover=Cross(EMA3,EMA15);
Buy=ExRem(Buy,Sell);
Sell=ExRem(Sell,Buy);

PlotShapes(IIf(Buy, shapeUpArrow, shapeNone),colorGreen, 0,Low,-15);
PlotShapes(IIf(Short, shapeDownArrow, shapeNone),colorRed, 0,High,-15);
PlotShapes(IIf(Cover, shapeHollowUpArrow, shapeNone),colorLime, 0,Low,-25);
PlotShapes(IIf(Sell,shapeHollowDownArrow, shapeNone),colorPink, 0,High,-25);trigger=IIf(Buy,bcon2,IIf(Short,scon2,Null));
Plot(trigger,"trigger",4,1);
TimeFrameRestore(); // restore time frame to original
enjoy don't forget to press reputation :)
 

Similar threads