Hello,
i want to add an additional rule in my strategy.
This rule is:
After a Longtrade only is possible a Shorttrade
and
after a Shorttrade only is possible a Longtrade.
How is the Code for this?
Thank You for help in advance!
Maddin
Hi, you only need to flag a variable when you launch a new trade:
once trade=0
if longconditions and (trade=-1 or trade=0) then
buy 1 lot at market
trade = 1
endif
if shortconditions and (trade=1 or trade=0) then
sellshort 1 lot at market
trade = -1
endif
Then test this “trade” variable to see if your last trade were a long or a short position.