Send order between sessions (when market are closed)

Questions about MultiCharts and user contributed studies.
youn56
Posts: 46
Joined: 29 Mar 2012
Has thanked: 13 times
Been thanked: 6 times

Send order between sessions (when market are closed)

Postby youn56 » 29 Oct 2012

Hi,

To be sure to be executed at the first tick price of the session (i trade with daily charts - automated strategy), i would like to send an order between sessions (when market are closed). Is it possible to do it and how ?
Thanks for your answers.
Best regards.

User avatar
Andrew MultiCharts
Posts: 1587
Joined: 11 Oct 2011
Has thanked: 931 times
Been thanked: 557 times

Re: Send order between sessions (when market are closed)

Postby Andrew MultiCharts » 29 Oct 2012

Hello Youn56,

Technically it is possible, but you should take into account several factors:
1. Your broker must allow you to place orders when session is over.
2. If you want to place orders from script, keep in mind that script must be calculating to place orders. So the data on chart should be updating. Daily bars may be not good resolution for this. RecalcLastBarAfter keyword can also help in this case.

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

Re: Send order between sessions (when market are closed)

Postby youn56 » 29 Oct 2012

Thanks Andrew,

My broker is IB. If i write something like that, do you think it will work ? will my order send and will submitted to IB (good for the next day : time in force (TIF) to "DAY") ?



if currenttime_s >210000 and currenttime_s <210100 then begin
buy next bar at market;
end;
if LastBarOnChart_s then RecalcLastBarAfter(10);

User avatar
TJ
Posts: 6558
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 966 times
Been thanked: 1893 times

Re: Send order between sessions (when market are closed)

Postby TJ » 29 Oct 2012

youn56 wrote:Thanks Andrew,

My broker is IB. If i write something like that, do you think it will work ? will my order send and will submitted to IB (good for the next day : time in force (TIF) to "DAY") ?



if currenttime_s >210000 and currenttime_s <210100 then begin
buy next bar at market;
end;
if LastBarOnChart_s then RecalcLastBarAfter(10);

You can use IB's papertrading account to test your code.
These users thanked the author TJ for the post:
Andrew MultiCharts

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

Re: Send order between sessions (when market are closed)

Postby youn56 » 30 Oct 2012

Hi Andrew,

I have tested the code with Ib's papertrading account and it doesn't work. MC didn't send the order to IB. However, the print function works well !
But I can manually send orders directly from MC.
Can you help me ?
Best regards.

Code: Select all

if LastBarOnChart_s then RecalcLastBarAfter(60);
if currenttime_s >182800 and currenttime_s <182900 then begin
       buy 100 shares next bar at market;
       print("ok");
end;

User avatar
Andrew MultiCharts
Posts: 1587
Joined: 11 Oct 2011
Has thanked: 931 times
Been thanked: 557 times

Re: Send order between sessions (when market are closed)

Postby Andrew MultiCharts » 30 Oct 2012

I have consulted with our engineers and there are some requirements for a strategy to place orders outside regular hours.
1. Outside real-time trading hours box must be checked.
2. A strategy will not place any orders if the session that is set in QuoteManager is finished. It means if you want to place orders after market is closed (18:00) and before a specified time (18:30), then you need to make sure session in QuoteManager for the symbol is set up to end at 18:30. However it may affect your charting. Only manual orders can be placed even if session is closed according to QM settings.

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

Re: Send order between sessions (when market are closed)

Postby youn56 » 30 Oct 2012

Thanks Andrew,
I tried and it doesn't work. i've created a special session for this and my setting for an order (at 20:00:00) are like this :

DIM - Edit Symbol_2012-10-30_19-54-04.png
DIM - Edit Symbol_2012-10-30_19-54-04.png (32.3 KiB) Viewed 186 times

Interactive Brokers Properties_2012-10-30_19-55-24.png
Interactive Brokers Properties_2012-10-30_19-55-24.png (41.53 KiB) Viewed 189 times

User avatar
Andrew MultiCharts
Posts: 1587
Joined: 11 Oct 2011
Has thanked: 931 times
Been thanked: 557 times

Re: Send order between sessions (when market are closed)

Postby Andrew MultiCharts » 02 Nov 2012

Is the order not generated at all by the script or generated and rejected by broker?
If it is not generated at all, i recommend you to check if the conditions for order placement are met or not a particular bar when you expect.


Return to “MultiCharts”