Just one more question:
In the strategy there can be a maximum of 2 positions.
After a first position, buy another position if the same conditions as the first position are met.
Or, buy another position, if the price falls 1% from the first position.
Not tested:
DEFPARAM CumulateOrders = true
IF Not OnMarket THEN
PriceFall = 0
EntryPrice = 0
ELSE
PriceFall = (close <= (EntryPrice * 0.99))
ENDIF
AddPosition = abs(CountOfPosition) < 2
IF (MyConditions OR PriceFall) AND AddPosition AND Not ShortOnMarket THEN
BUY 1 CONTRACT AT MARKET
IF abs(CountOfPosition) = 0 THEN
EntryPrice = close
ENDIF
ENDIF
That’s what you asked
“After a first position, buy another position if the same conditions as the first position are met.
Or, buy another position, if the price falls 1% from the first position.”
I am not GraHal.
If you don’t want to buy the second position with the same conditions as the first one, change line 9:
IF ((MyConditions AND (Countofposition = 0)) OR PriceFall) AND AddPosition AND Not ShortOnMarket THEN
Post your code if you want help about it, instead of general examples.