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.
Send order between sessions (when market are closed)
- Andrew MultiCharts
- Posts: 1587
- Joined: 11 Oct 2011
- Has thanked: 931 times
- Been thanked: 559 times
Re: Send order between sessions (when market are closed)
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.
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.
Re: Send order between sessions (when market are closed)
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);
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);
- TJ
- Posts: 7740
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2221 times
Re: Send order between sessions (when market are closed)
You can use IB's papertrading account to test your code.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);
Re: Send order between sessions (when market are closed)
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.
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;
- Andrew MultiCharts
- Posts: 1587
- Joined: 11 Oct 2011
- Has thanked: 931 times
- Been thanked: 559 times
Re: Send order between sessions (when market are closed)
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.
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.
- Andrew MultiCharts
- Posts: 1587
- Joined: 11 Oct 2011
- Has thanked: 931 times
- Been thanked: 559 times
Re: Send order between sessions (when market are closed)
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.
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.