i want to go long when a bull candle is over the 20ma. the codes i got for it is
1
2
3
4
5
6
ma20=Average[20](close)//set ma20 as the 20 simple moving average
bullcandle=(close>open)//bull candle
c1=(open>=ma20)ANDbullcandle
IFc1then
BUY1CONTRACTATMARKET
ENDIF
some candles done on the backtest satisfy what i was coding it for but some do not. like the one on the picture. can anyone explain what i am doing wrong and how can i improve thanks.