Hello everyone,
My automated trading strategy (IB is my broker) needs to place orders at market opening so that the order fills when the main trading session starts.
At Interactive Brokers it is called market OPG order.
I know that this type of order is not supported (really useful feature BTW) but may be there is a possibility to release such order type using PowerLanguage/EasyLanguage?
May be somebody tried to code it already?
The main advantage of such an order type is that you get your order filled at the price which is exact trading session start price... Which is great for trading strategies on Daily charts.
Thank you!
Simulate MOO (Market on Open) / OPG Market Order
Re: Simulate MOO (Market on Open) / OPG Market Order
Complicated.
If assuming you have to have orders submitted pre-open (the only way to achieve a fill at the opening price as you describe) and assuming that simply having a GTC order working from a previous session is not what you want, then:
You will need intrabarordergeneration enabled and use AllowSendOrdersAlways. Also use recalclastbarafter.
That then opens up the possibility to finely define exactly when to send orders. You can then use computer time to trigger script calc and send maximally aggressive limit orders 10 mins before the scheduled open.
That is a lot of work if you're not experienced.
I would opt to instead detect the session last bar using sessionlastbar keyword to trigger script calc the moment the first tick of the new session arrives.
It certainly won't guarantee a fill at the open, but is easier.
If you're using daily bars then you don't even need to do that. Simply:
If assuming you have to have orders submitted pre-open (the only way to achieve a fill at the opening price as you describe) and assuming that simply having a GTC order working from a previous session is not what you want, then:
You will need intrabarordergeneration enabled and use AllowSendOrdersAlways. Also use recalclastbarafter.
That then opens up the possibility to finely define exactly when to send orders. You can then use computer time to trigger script calc and send maximally aggressive limit orders 10 mins before the scheduled open.
That is a lot of work if you're not experienced.
I would opt to instead detect the session last bar using sessionlastbar keyword to trigger script calc the moment the first tick of the new session arrives.
Code: Select all
if sessionlastbar=true then buy next bar at market;
If you're using daily bars then you don't even need to do that. Simply:
Code: Select all
if buy_condition=true buy next bar at market;
- TJ
- Posts: 7742
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2222 times
Re: Simulate MOO (Market on Open) / OPG Market Order
A workaround:
Set the session time one bar early.
Set the session time one bar early.
- TJ
- Posts: 7742
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2222 times
Re: Simulate MOO (Market on Open) / OPG Market Order
eg.
if you are using a 5 min chart, and the instrument opens at 9:30 am
You can set the session time to start at 9:25 am,
then your strategy can buy/sell market at next bar.
if you are using a 5 min chart, and the instrument opens at 9:30 am
You can set the session time to start at 9:25 am,
then your strategy can buy/sell market at next bar.
Re: Simulate MOO (Market on Open) / OPG Market Order
Thank you TJ. I think it is the most simplest way to simulate such type of orders.
I will definitely try it.
However I doubt that the price I'll get in real market will exactly match "the first printed price". It may work on high-liquidity instruments with no guarantee of course.
Just for information: the exchanges gather such types of orders (MOO orders) and at 9:28 a.m. - 09:30 a.m. market-making sellers gauge how many orders are waiting for execution at the open, and what the nature of those orders might be (large or small, buy or sell, Limit, Stop or Market). They adjust their bids and offers based on this information and the first trade of the session will establish the opening price.
Dear TJ!
Is there any chance to include such type of order into To-Do list for the next software builds at least for automated trading?
I see that it could be easily released using TWS API: http://interactivebrokers.github.io/tws ... rders.html - Market On Open
I'm sure it is also available at other brokers' APIs as it is one of the popular order types for trading on Daily charts.
I will definitely try it.
However I doubt that the price I'll get in real market will exactly match "the first printed price". It may work on high-liquidity instruments with no guarantee of course.
Just for information: the exchanges gather such types of orders (MOO orders) and at 9:28 a.m. - 09:30 a.m. market-making sellers gauge how many orders are waiting for execution at the open, and what the nature of those orders might be (large or small, buy or sell, Limit, Stop or Market). They adjust their bids and offers based on this information and the first trade of the session will establish the opening price.
Dear TJ!
Is there any chance to include such type of order into To-Do list for the next software builds at least for automated trading?
I see that it could be easily released using TWS API: http://interactivebrokers.github.io/tws ... rders.html - Market On Open
I'm sure it is also available at other brokers' APIs as it is one of the popular order types for trading on Daily charts.
- TJ
- Posts: 7742
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2222 times
Re: Simulate MOO (Market on Open) / OPG Market Order
I am not MultiCharts. I do not call the shots.. . .
Dear TJ!
Is there any chance to include such type of order into To-Do list for the next software builds at least for automated trading?
I see that it could be easily released using TWS API: http://interactivebrokers.github.io/tws ... rders.html - Market On Open
I'm sure it is also available at other brokers' APIs as it is one of the popular order types for trading on Daily charts.
You can make a feature request here:
https://www.multicharts.com/pm/public/multicharts
Re: Simulate MOO (Market on Open) / OPG Market Order
Anyway thank you, TJ, for your help.
I found an old feature request for this type of order. It is really must-have feature for those who trade using Daily charts.
Here you can vote for it: https://www.multicharts.com/pm/public/m ... es/MC-1754
I found an old feature request for this type of order. It is really must-have feature for those who trade using Daily charts.
Here you can vote for it: https://www.multicharts.com/pm/public/m ... es/MC-1754