I want to be sent stop and limit orders (exits) from a strategy only during main session, not in pre market time and not in after market time. So I said each strategy part (StopLoss, Profit Target, …) only to act in specific time (main session):
Simple example:
Inputs: EntryTime(0900), ExitTime(1735), Amount (1000);
If time> EntryTime and time<ExitTime then Begin;
SetStopLoss(Amount);
End;
The problem: The strategies sends exit orders to the broker after the main session … in after market trading.
How can I stop this? How can I cancel an order after main session at broker from a strategy automatically ?
I want the strategy to cancel the exit orders after main session and to reopen the exit orders next day at market open. How can i do this?
Thank you for your support!
Auto trading can cancel the order if the condition in the code is no longer met.
Your logic is correct and the orders should be placed only between EntryTime(0900) and ExitTime(1735).
The time you are specifying in the script is the chart time. Please make sure you are specifying correct Exchange time in the script/inputs if the chart time zone is Exchange and Local time if the chart is in local time.
Please let me know if this solution helped you or not.