Logic of MarketNextBar with IOGMode.Enabled

Questions about MultiCharts .NET and user contributed studies.
AntiMatter
Posts: 60
Joined: 03 Mar 2011
Has thanked: 9 times
Been thanked: 2 times

Logic of MarketNextBar with IOGMode.Enabled

Postby AntiMatter » 20 Nov 2013

I have IOGMode.Enabled

I want orders to be sent as soon as a tick fulfills my condition. For example:

if ( my_stop_loss >= Bars.Close[0] )
{
sell_order.Send();
}

1) When I use OrderCreator.MarketThisBar, it actually waits until the close of the bar (e.g. on a minute bar, it could wait up to 1 minute before processing the order.
2) When I use OrderCreator.MarketNextBar, then it processes the order on the following tick.

Is this the correct/expected behavior? Is there some way I can send the order immediately (i.e. as soon as a tick satisfies my condition?

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

Re: Logic of MarketNextBar with IOGMode.Enabled

Postby Henry MultiСharts » 20 Nov 2013

Hello AntiMatter

Our MultiCharts .NET Programming guide provides comprehensive information regarding order objects in MultiCharts.
4.6.1 Orders:
IOrderMarket OrderCreator.MarketThisBar(SOrderParameters orderParams); - creates a Market order that should be sent on the Close of the bar where it was generated.
When I use OrderCreator.MarketNextBar, then it processes the order on the following tick.
That is correct and expected behavior. There is no way to send the order when the tick satisfies your condition. You can send the order only on the next tick after the tick satisfies your condition.

AntiMatter
Posts: 60
Joined: 03 Mar 2011
Has thanked: 9 times
Been thanked: 2 times

Re: Logic of MarketNextBar with IOGMode.Enabled

Postby AntiMatter » 20 Nov 2013

Am I the only person to think that it be better to have a way to send an order *immediately*, or am I missing something here?

User avatar
JoshM
Posts: 2195
Joined: 20 May 2011
Location: The Netherlands
Has thanked: 1544 times
Been thanked: 1565 times
Contact:

Re: Logic of MarketNextBar with IOGMode.Enabled

Postby JoshM » 20 Nov 2013

(...)You can send the order only on the next tick after the tick satisfies your condition.
Am I the only person to think that it be better to have a way to send an order *immediately*, or am I missing something here?
As Henry said, you can also send the order on the next tick. In that case, you'll need to use IntrabarOrderGeneration, with which orders that are scheduled for 'next bar' are send on 'next tick'.

As you meant immediately in the sense of submit orders on the same tick as the conditions are evaluated, I thought that, with IOG, MarketThisBar would become 'this tick' (but you'll need to verify that yourself).

AntiMatter
Posts: 60
Joined: 03 Mar 2011
Has thanked: 9 times
Been thanked: 2 times

Re: Logic of MarketNextBar with IOGMode.Enabled

Postby AntiMatter » 20 Nov 2013

I thought that, with IOG, MarketThisBar would become 'this tick' (but you'll need to verify that yourself).
No, it doesn't.

As per my initial post: If we have a one minute chart, with IOGMode.Enabled, then OrderCreator.MarketThisBar waits until the close of the 1-minute bar before it is processed.

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

Re: Logic of MarketNextBar with IOGMode.Enabled

Postby Henry MultiСharts » 20 Nov 2013

Am I the only person to think that it be better to have a way to send an order *immediately*, or am I missing something here?
At the moment that is not technically possible to send an order during the same calculation that the order is generated.

AntiMatter
Posts: 60
Joined: 03 Mar 2011
Has thanked: 9 times
Been thanked: 2 times

Re: Logic of MarketNextBar with IOGMode.Enabled

Postby AntiMatter » 20 Nov 2013

OK Thanks.

This can be a problem in low and medium volume markets, where you could perhaps wait more than a minute before the order is processed. This could be the case even in some reasonably well traded stocks, but at a quite time of the day.

User avatar
JoshM
Posts: 2195
Joined: 20 May 2011
Location: The Netherlands
Has thanked: 1544 times
Been thanked: 1565 times
Contact:

Re: Logic of MarketNextBar with IOGMode.Enabled

Postby JoshM » 20 Nov 2013

No, it doesn't.

As per my initial post: If we have a one minute chart, with IOGMode.Enabled, then OrderCreator.MarketThisBar waits until the close of the 1-minute bar before it is processed.
That's right.

But in that situation you can use MarketNextBar, so you don't have to wait another minute.
This can be a problem in low and medium volume markets, where you could perhaps wait more than a minute before the order is processed. This could be the case even in some reasonably well traded stocks, but at a quite time of the day.
I thought orders could also be send on forced CalcBar() recalculation; with ExecControl.RecalcLastBarAfter().

AntiMatter
Posts: 60
Joined: 03 Mar 2011
Has thanked: 9 times
Been thanked: 2 times

Re: Logic of MarketNextBar with IOGMode.Enabled

Postby AntiMatter » 20 Nov 2013

I thought orders could also be send on forced CalcBar() recalculation; with ExecControl.RecalcLastBarAfter().
Ah, will try this, thanks.


Return to “MultiCharts .NET”