can't create order objects on the fly

Questions about MultiCharts .NET and user contributed studies.
drolles
Posts: 50
Joined: 03 Dec 2012
Has thanked: 4 times

can't create order objects on the fly

Postby drolles » 29 Dec 2012

The ordercreator method seems to be protected and unable to be called in CalcBar

I want to be able to create Order objects on the fly, how do I do that?

Thanks and regards,

drolles

MidKnight
Posts: 343
Joined: 12 Aug 2012
Has thanked: 123 times
Been thanked: 56 times

Re: can't create order objects on the fly

Postby MidKnight » 29 Dec 2012

The ordercreator method seems to be protected and unable to be called in CalcBar

I want to be able to create Order objects on the fly, how do I do that?

Thanks and regards,

drolles
As far as I know, you don't do that. I do not really know much of the details about what actually happens behind the scenes with Order objects, but the general approach is to create your order objects in Create() and send them in CalcBar(). Behind the scenes I do not know what that actually translates to with the broker, ie. does this mean orders are cancelled and re-submitted thus changing your position in the queue? I don't know, but I would hope it is smart enough to NOT do this.

drolles
Posts: 50
Joined: 03 Dec 2012
Has thanked: 4 times

Re: can't create order objects on the fly

Postby drolles » 30 Dec 2012

MidKnight,

Thanks for the reply.

Possibly I’m coming at this with assumptions from OpenQuant but how do I know the conditions of each owner at the time of creation?

Are we in a managed vs unmanaged situation here

What about if I need to adjust a target level of a limit order? How do I do that in CalcBar?

Cheers,

drolles

MidKnight
Posts: 343
Joined: 12 Aug 2012
Has thanked: 123 times
Been thanked: 56 times

Re: can't create order objects on the fly

Postby MidKnight » 30 Dec 2012

If you are using a target limit order to exit an open position, your code will need a IOrderPriced object that you will Send(price) every time in CalcBar(). If you want to change the price, then simply modify the value you Send() -- does that make sense?

drolles
Posts: 50
Joined: 03 Dec 2012
Has thanked: 4 times

Re: can't create order objects on the fly

Postby drolles » 31 Dec 2012

Thanks MK.

Ok, that does make sense. Perfect sense. I’ve looked these up in the PL Language Ref. Perfect. Can I control when these orders expire?

The thing I don’t understand is how you determine what orders are being generated by your strategy: viewtopic.php?f=19&t=11664

Cheers,

drolles

drolles
Posts: 50
Joined: 03 Dec 2012
Has thanked: 4 times

Re: can't create order objects on the fly

Postby drolles » 31 Dec 2012

MK, I’ve looked further into this.

I’ve found the order expiry property within the TradeManager class for orders.

I’m a little confused here. In OpenQuant (and other platforms) the backtester simulator acts like a broker, the backtester here seems to be behaving like something else.

What’s the function of the trade manager class Order object as opposed to the Order object in the PowerLangauge Namespace? I’ve found a thread which looks to create event / methods which track things like order fills (viewtopic.php?f=19&t=10698). I’m confused as to why you would create those things…?

Can the TradeManager class be used in backtest?

Cheers,

drolles

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

Re: can't create order objects on the fly

Postby Henry MultiСharts » 04 Jan 2013

I’m a little confused here. In OpenQuant (and other platforms) the backtester simulator acts like a broker, the backtester here seems to be behaving like something else.
PowerLanguage Backtester works differently from the broker simulators. On a study calculation a set of orders is generated. Orders live until the next study calculation. To continue sending orders they should be generated on each calculation. The orders are not actually sent, that is why there are no cancelled/rejected orders.
Can the TradeManager class be used in backtest?
TradeManager class cannot be used in backtesting. TradeManager provides access to the Order and Position Tracker window that contains information only regarding actual trades generated and sent to the broker.

drolles
Posts: 50
Joined: 03 Dec 2012
Has thanked: 4 times

Re: can't create order objects on the fly

Postby drolles » 06 Jan 2013

PowerLanguage Backtester works differently from the broker simulators. On a study calculation a set of orders is generated. Orders live until the next study calculation. To continue sending orders they should be generated on each calculation. The orders are not actually sent, that is why there are no cancelled/rejected orders.
Thanks for that. I don't understand what you mean by "next study calculation". Do you mean each time CalBar is run?
TradeManager class cannot be used in backtesting. TradeManager provides access to the Order and Position Tracker window that contains information only regarding actual trades generated and sent to the broker.
Thanks. As per my other thread this is industry standard functionality to see the orders generated by your strategy in backtest (viewtopic.php?f=19&t=11664).

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

Re: can't create order objects on the fly

Postby Henry MultiСharts » 09 Jan 2013

Thanks for that. I don't understand what you mean by "next study calculation". Do you mean each time CalBar is run?
Yes, that is correct.


Return to “MultiCharts .NET”