Sending an order in a signal before the market opens

Questions about MultiCharts and user contributed studies.
monick
Posts: 19
Joined: 20 Nov 2015

Sending an order in a signal before the market opens

Postby monick » 21 Nov 2015

I am having difficulty in sending an order in the pre-market when the exchange allows orders, but before the market is open. Here are the steps I assumed would need to be taken.

1) Set the open time for the symbol earlier in the symbol definition (let's say 15 minutes)

2) Enable IOG

3) Start the code with recalclastbarafter(1)

Doing these two things, I still cannot get the strategy to attempt to send an order.

Do I need to change the value of 300 in the closebartimeout setting in the registry editor?

Can't think what else would need to be changed.

User avatar
TJ
Posts: 7742
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2222 times

Re: Sending an order in a signal before the market opens

Postby TJ » 21 Nov 2015

I am having difficulty in sending an order in the pre-market when the exchange allows orders, but before the market is open. Here are the steps I assumed would need to be taken.

1) Set the open time for the symbol earlier in the symbol definition (let's say 15 minutes)

2) Enable IOG

3) Start the code with recalclastbarafter(1)

Doing these two things, I still cannot get the strategy to attempt to send an order.

Do I need to change the value of 300 in the closebartimeout setting in the registry editor?

Can't think what else would need to be changed.

From MultiCharts' perspective,
it does not know (or care) whether you are trading pre-market or after-market. As long as there are bars on the chart, it will process your trading logic and send the triggered orders. It is up to your broker to accept the orders.

If the orders are not triggered in MultiCharts, then you have to review your trading logic.


One thought...

Who is your broker?
What instrument are you trading?

For IB, you have to configure your TWS to accept orders outside of RTH.

monick
Posts: 19
Joined: 20 Nov 2015

Re: Sending an order in a signal before the market opens

Postby monick » 21 Nov 2015

My broker is CCQ.

I can send orders manually on the trade bar or price ladder, so this is not the issue.

I am trading crude oil CL and silver SI.

Clearly IOG must be enabled or a tick will not occur. There are bars on the chart.

The conditions to be met are based on the current bid and current ask of data2, which is crude or silver and a time component (time_s > 174500).

I'm trying to send limit orders and using buy next bar at xxx limit;

User avatar
TJ
Posts: 7742
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2222 times

Re: Sending an order in a signal before the market opens

Postby TJ » 22 Nov 2015

My broker is CCQ.

I can send orders manually on the trade bar or price ladder, so this is not the issue.

I am trading crude oil CL and silver SI.

Clearly IOG must be enabled or a tick will not occur. There are bars on the chart.

The conditions to be met are based on the current bid and current ask of data2, which is crude or silver and a time component (time_s > 174500).

I'm trying to send limit orders and using buy next bar at xxx limit;
You have to learn to debug.
You have a lot of data points, do you know if are you getting data in those data points to trigger your logic?

What do you mean by:
>Clearly IOG must be enabled or a tick will not occur.

I afraid you do not have a correct understanding of IOG. It has nothing to do with tick occuring. Please refer to an EasyLanguage manual again for detail.


Sorry, can't help you more without any specifics.

monick
Posts: 19
Joined: 20 Nov 2015

Re: Sending an order in a signal before the market opens

Postby monick » 22 Nov 2015

I misspoke when I said "Clearly IOG must be enabled or a tick will not occur. " I didn't mean that a tick will not occur. I meant that one will not send an order without a tick occurring.

Well let's say you run a strategy WITHOUT IOG enabled. Two scenarios.

1) Run the strategy on 1 hour bars. As i understand it, with buy next bar at limit, you will only send an order at the beginning of each one hour bar.

2) Run the strategy on 1 second bars. Now you have the possibility to send an order every single second. However, if there are no trades (ticks) then new bars do not form every second.

So in order to send orders in the pre-market when there are no trades occurring, I would think that regardless of the length of your bar, that IOG would have to be enabled.

Am I wrong on this point?

User avatar
TJ
Posts: 7742
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2222 times

Re: Sending an order in a signal before the market opens

Postby TJ » 22 Nov 2015

I misspoke when I said "Clearly IOG must be enabled or a tick will not occur. " I didn't mean that a tick will not occur. I meant that one will not send an order without a tick occurring.

Well let's say you run a strategy WITHOUT IOG enabled. Two scenarios.

1) Run the strategy on 1 hour bars. As i understand it, with buy next bar at limit, you will only send an order at the beginning of each one hour bar.

2) Run the strategy on 1 second bars. Now you have the possibility to send an order every single second. However, if there are no trades (ticks) then new bars do not form every second.

So in order to send orders in the pre-market when there are no trades occurring, I would think that regardless of the length of your bar, that IOG would have to be enabled.

Am I wrong on this point?

IOG is for generating an order intra-bar.
so the one and only question is -- Do you want your orders generated intra-bar?
There are no other considerations in determining whether you should or should not use IOG.

Since you have already activated recalclastbarafter,
whether there is a new tick or not is not relevant anymore.

Are you sure the problem is in sending orders,
Have you acertained that the orders have been triggered?

Please study the debug link I refer to in my previous post.

monick
Posts: 19
Joined: 20 Nov 2015

Re: Sending an order in a signal before the market opens

Postby monick » 29 Nov 2015

Hi TJ,
Thanks for your help. Still very stuck here. Just want to strip down the situation here and simplify as much as possible. Perhaps you could help. All I want to do is send an order in the pre-market via a strategy.

1) Send an order to buy 1 CLF6 (Jan crude future) at 44 limit at 545 pm est (15 minutes before the open when pre-market orders are allowed, again I have no problem doing this manually on a price ladder)

How would you accomplish this? Could you include a very simple line(s) of code and the settings you would use? To summarize, I want to trade in the opening print at 6 pm est.

Thanks

User avatar
TJ
Posts: 7742
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2222 times

Re: Sending an order in a signal before the market opens

Postby TJ » 29 Nov 2015

Hi TJ,
Thanks for your help. Still very stuck here. Just want to strip down the situation here and simplify as much as possible. Perhaps you could help. All I want to do is send an order in the pre-market via a strategy.

1) Send an order to buy 1 CLF6 (Jan crude future) at 44 limit at 545 pm est (15 minutes before the open when pre-market orders are allowed, again I have no problem doing this manually on a price ladder)

How would you accomplish this? Could you include a very simple line(s) of code and the settings you would use? To summarize, I want to trade in the opening print at 6 pm est.

Thanks
I can't help you without testing your code.

As far as I know, there are no special settings or coding required.
MultiCharts does not know (or care) which trading session you are in.

Please see the debug link in my post #4; you have not tested your variables. You need to do that before further investigation.

Please contact tech support online if you still have problems.

monick
Posts: 19
Joined: 20 Nov 2015

Re: Sending an order in a signal before the market opens

Postby monick » 30 Nov 2015

Here is the code running on CLF6 in rithmic with 2 hour bars. It doesn't send the order till the market opens at 6 pm est.

Code: Select all

[IntrabarOrderGeneration = true]
recalclastbarafter(1);
buy ("buy") 1 share next bar at 41.50 limit;

User avatar
TJ
Posts: 7742
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2222 times

Re: Sending an order in a signal before the market opens

Postby TJ » 30 Nov 2015

Here is the code running on CLF6 in rithmic with 2 hour bars. It doesn't send the order till the market opens at 6 pm est.

Code: Select all

[IntrabarOrderGeneration = true]
recalclastbarafter(1);
buy ("buy") 1 share next bar at 41.50 limit;
What is your chart session time?

monick
Posts: 19
Joined: 20 Nov 2015

Re: Sending an order in a signal before the market opens

Postby monick » 30 Nov 2015

Aah, Perhaps this is it. I had changed the instrument time to

Sunday-Monday 1700-1700
Monday-Tuesday 1700-1700
Tuesday-Wednesday 1700-1700
Wednesday-Thursday 1700-1700
Thursday-Friday 1700-1700

But I did not change the chart session time. It is set to default. I should try 24 hour I suppose.


Return to “MultiCharts”