if time >= 220000 and dayofweek=5 then
sell at market
exitshort at market
endif
I use this code on all my systems to close open positions on Friday evening. From time to time, however, systems with open positions are still held over the weekend. So, for whatever reason, the code didn’t work. Positions are then closed at market open on Sunday evening and systems halted. I still haven’t figured out why that is. It doesn’t matter which TF. It affects M1, M5 and M15 systems. Always completely sporadic.
Is there another way to close open positions?
Or is it the time? Maybe too close at the market close?
JSParticipant
Senior
I think it’s indeed due to the time, right on the closure… It can (sporadically) happen that you can no longer even lose your market orders…
Taking into account your longest time frame, for example 15 minutes, you can try:
If Time >= 214500 and …
What if there are no buyers during that one hour remaining ?
Edit : Oh, I see that JS just said similar.