// Conditions to enter long positions
IF (x > y) AND (x > 70) AND (sslUp > sslDown) THEN
BUY 1 PERPOINT AT MARKET
ENDIF
// Conditions to exit long positions
IF (sslUP < sslDown) OR (y > x) THEN
SELL AT MARKET
ENDIF
// Conditions to enter short positions
IF (sslDown > sslUp) AND (y > 70) AND (y > x) THEN
SELLSHORT 1 PERPOINT AT MARKET
ENDIF
// Conditions to exit short positions
IF (sslUP > sslDown) OR (x > y) THEN
EXITSHORT AT MARKET
ENDIF
Hi
In the above code to enter long positions, I want to use AND and OR e.g.
// Conditions to enter long positions
IF ((x > y) AND (x > 70)) OR (sslUp > sslDown) THEN
BUY 1 PERPOINT AT MARKET
ENDIF
Is my above code modification correct? Do I need to put OR onto the next line? Do I need to use ELSIF? Any suggestions please?
Thanks
Sachin
Your conditions seem fine. If they work as you expect then they are fine!
There’s no need to use ELSIF, I think it’s more readable the way you wrote it.
I can only suggest that you add “AND LongOnMarket” at line 9:
IF ((sslUP < sslDown) OR (y > x)) AND LongOnMarket THEN
and “AND ShortOnMarket” at line 21:
IF ((sslUP > sslDown) OR (x > y)) AND ShortOnMarket THEN
but it’s not mandatory.