Hi guys, when venturing into the point where you want to add more positions to your trade automatic, please remember to set “defparam cumulateorders=true” otherwise you might use 1 hour- like me, wondering why it does not work. This is just the example from the documentation.
defparam cumulateorders=TRUE
myMACD = MACD[12,26,9](close)
long = myMACD crosses over 0
exit = myMACD crosses under 0
//first order
IF NOT LongOnMarket AND long THEN
BUY 1 CONTRACTS AT MARKET
ENDIF
If LongOnMarket AND exit THEN
SELL AT MARKET
ENDIF
ind=0
//let's add another order while price continue to get higher (more than 10 points) than the last order taken with a condition of 5 bars elapsed since then
IF BARINDEX-TRADEINDEX(1)>5 AND Close-TRADEPRICE(1)>10 AND LongOnMarket THEN
BUY 1 CONTRACTS AT MARKET
Ind=1
ENDIF
//trailing stop for the whole orders
SET STOP %TRAILING 1.5
Graph ind COLOURED(255,0,0) AS "condition" //red indicate if the extra orders were triggered