Afl Code hhv llv

#2
How to code this
buy=c+10;
and my stop loss is lowest value of last 10 candles after buy initiated how to code this
sell condition
The code below buys to Open the next bar the condition Close>highest high in the last 10 days is verified:

SetTradeDelays (1,1,1,1);
buy = C>ref (hhv(H, 10), -1);
buyprice = O;

I dont undestand your sell condition, anyway the following code close after ten bar since buy.

sell = ref(buy, -9);
sellprice=C;

and this one closes when close is lower than lowest low of the last 10bars;
sell = C< ref( llv(L, 10), -1);
Sellprice = O;


Hope it helps
 

Similar threads