I want to set up a trading strategy that uses three entry signals to go "fully long."
Ideally:
- I want the first long to happen when the price closes above an EMA.
- The second, heavier, long to happen when there is an EMA crossover.
- And then the third which would double the position size will happen when the close is above the donchian channel.
I have named each entry a different ID thinking I could limit an entry to 1.
I tried pyramiding but it would keep entering the first trade over and over again if the price dipped below for a day and then came back up. It wouldn't hit my stop so it would just add a single contract to the position.
//Over EMA 2
lCOne = crossover(close,ematwo)
//EMA1 crossover EMA2
lCTwo = crossover(emaone, ematwo)
//Close above upper DC
lCThree = crossover(close,DChiHighs)
CloseOne = crossunder(close,DCloLows)
CloseTwo = crossunder(close,ematwo)
//if (lCOne)
strategy.risk.max_position_size(3)
strategy.entry("LONG ONE", strategy.long,1, when = lCOne)
strategy.entry("LONG TWO", strategy.long,2, when = lCTwo)
strategy.entry("LONG THREE", strategy.long,3, when = lCThree)
strategy.close("LONG ONE",when = CloseOne)
strategy.close("LONG TWO",when = CloseTwo)
strategy.close("LONG THREE",when = CloseTwo)