I need a simple script to backtest ;
Buy: Two Green heikin ashi candles after a Red candle.
Sell: Two Red heikin ashi candles after a Green candle.
Thanks for your help in advance.
I need a simple script to backtest ;
Buy: Two Green heikin ashi candles after a Red candle.
Sell: Two Red heikin ashi candles after a Green candle.
Thanks for your help in advance.
Here is skeleton AFL which might need other improvements. But Basic AFL is as follows
// Author kamal.delhi.india at the rate gmail.
// Two Green Heiken after Red confirms Buy
// Two Red Heiken after Green confirms Sell
_SECTION_BEGIN("Heiken");
HaClose=(O+H+L+C)/4;
HaOpen = AMA( Ref( HaClose, -1 ), 0.5 );
HaHigh = Max( H, Max( HaClose, HaOpen ) );
HaLow = Min( L, Min( HaClose, HaOpen ) );
PlotOHLC( HaOpen, HaHigh, HaLow, HaClose, "" + Name(), colorWhite, styleCandle | styleNoLabel );
Buy = (Ref( HaClose, -3 ) < Ref( HaOpen, -3 )) AND (Ref( HaClose, -2 ) > Ref( HaOpen, -2 )) AND (Ref( HaClose, -1 ) > Ref( HaOpen, -1 ));
Sell = (Ref( HaClose, -3 ) > Ref( HaOpen, -3 )) AND (Ref( HaClose, -2 ) < Ref( HaOpen, -2 )) AND (Ref( HaClose, -1 ) < Ref( HaOpen, -1 ));
Short = False;
Cover = False;
_SECTION_END();