How do i code this?
I want my long positions to close on Friday night 22:00 and no more entry after 22:00 on Friday.
IF DAYOFWEEK = 5 AND TIME = 220000 THEN
SELL AT MARKET
ENDIF
I use this but a new position open 22:10 on Friday.
Try this
if opendayofweek = 5 and openhour >= 22 and openminute >= 00 then
sig=1
else
sig=0
endif
Then you have to put sig=1 into your entry conditions
Add this to your conditions when BUYing:
[scode]
AND Not (Time >= 220000 And DayOfWeek = 5)
[/scode]
like this 🙂
if sig=1 then
sell at market
endif
// Friday 22:00 Close ALL operations.
if opendayofweek = 5 and openhour >= 22 and openminute >= 00 then
sig=1
else
sig=0
endif
IF c1 AND C2 AND C3 AND Not (Time >= 220000 And DayOfWeek = 5) THEN
BUY 3 CONTRACT AT MARKET
ENDIF