Thank you, yes this does help. I was on the right track but never got it exactly. My solution is as follows. Purely in terms of the condition as mentioned. I use the variable “POS”. This seems to have done the trick.
IF c1 and pos<1 THEN
BUY positionsize CONTRACT AT MARKET
ENDIF
if longonmarket then
pos=2
endif
And for short trades the following:
IF c3 and pos>-1 THEN
SELLSHORT positionsize CONTRACT AT MARKET
ENDIF
if shortonmarket then
pos=-2
endif
1 user thanked author for this post.