AFL help required

#1
i want to code afl for my following logic:
buy when 20 ema >50 ema and next candle is half percent higher than previous candle close value.
i have following code but not working
Up = Ema (C, 20) > Ema (C, 50);
BuyV = up AND (C > ( Ref(C, -1)+ C*.0005));
Down = Ema (C, 50) > Ema (C, 20);
SellV = down AND (C < ( Ref(C, -1)-C*.0005)) ;
 

travi

Well-Known Member
#2
i want to code afl for my following logic:
buy when 20 ema >50 ema and next candle is half percent higher than previous candle close value.
i have following code but not working
Up = Ema (C, 20) > Ema (C, 50);
BuyV = up AND (C > ( Ref(C, -1)+ C*.0005));
Down = Ema (C, 50) > Ema (C, 20);
SellV = down AND (C < ( Ref(C, -1)-C*.0005)) ;
Don't avoid shortcuts, always write code properly and secondly use a calc if required,

bcos it should be

BuyV = Up AND (C > ( Ref(C, -1) + (C * 0.005) ));

it doesn't cost anything to use an extra 0 or extra round brackets.
and 0.5% is 0.005
 

Similar threads