i'm trying to setup a funcion to close the operation at 17.25 (5 minutes before end in European time) using the following code:
The problem is that the "time" function recognize the time at the end of the bar and using the 3 line break if the bar is not close at this time don't work.
Code: Select all
If time >=SessEnd and Marketposition<0 Then
BuytoCover ("STime") currentshares shares this bar on close;
If time >=SessEnd and Marketposition>0 Then
Sell ("LTime") currentshares shares this bar on close;
i have tried with currenttime to use the computer time, but if you use in chart after the close will generate close of all open trade at second bar..
Have you any suggestion?