How to cancel or prevent exit orders out of main session?

Questions about MultiCharts and user contributed studies.
Gaempi
Posts: 60
Joined: 27 Jul 2010
Location: Switzerland
Has thanked: 3 times
Been thanked: 8 times

How to cancel or prevent exit orders out of main session?

Postby Gaempi » 30 Apr 2012

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:

Code: Select all

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!

youn56
Posts: 46
Joined: 29 Mar 2012
Has thanked: 13 times
Been thanked: 6 times

Re: How to cancel or prevent exit orders out of main session

Postby youn56 » 01 May 2012

Perhaps another solution exists. You can try to custom the session.
For us stock for example :

QuoteManager --> Select your symbol --> Edit Symbol -->

1 - Settings tab --> Choose Use Custom Settings.
2 - Sessions tab --> Use Custom Session Template --> Choose the template : "US Stocks (Regular Trading Hours).

Regards,

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: How to cancel or prevent exit orders out of main session

Postby Henry MultiСharts » 01 May 2012

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.


Return to “MultiCharts”