Hi
I’m sure the answer is somewhere at this forum but I can’t find it so:
How to code “Close after X minutes”
What TF are you using?
Close after X minutes from…. the opening of a trade, no matter whether it’s gaining or losing?
At the moment 5 sec.
Yep, X minutes after opening whatever the result is.
This should work (not tested):
IY MyConditions THEN
BUY/SELLSHORT....
MyMinute = OpenMinute
ENDIF
x = OpenMinute - MyMinute
IF x < 0 THEN
x = x + 60
ENDIF
IF x >= 5 THEN
SELL/EXITSHORT....
ENDIF