My AFL basically buys when MA(20)starts trending up. The system should buy only when my buyprice is hit. var1 = MA( Close, 20 ); Cond1 = Ref( var1, -4 ) < Ref( var1, -5 ) ; Cond2 = Ref( var1, -3 ) < Ref( var1, -4 ); Cond3 = Ref( var1, -2 ) > Ref( var1, -3 ) ; Cond4 = Ref( var1, -1 ) > Ref( var1, -2 ); BuyPrice = Ref( Close, -1 ) - ( ATR(10) * 0.5 ) ; Buy = Cond1 AND Cond2 AND Cond3 AND Cond4 ;
But when I back test the above formula, it buys at bar low even when my buyprice is not hit. How to avoid it buying at bar low? Thanks in advance.