TradeManager events questions.

Questions about MultiCharts .NET and user contributed studies.
zysmn
Posts: 68
Joined: 27 Feb 2014
Has thanked: 7 times
Been thanked: 4 times

TradeManager events questions.

Postby zysmn » 30 Apr 2015

Hello.
I try to deeper understand how TradeManager events works. For these purpose I wrote simple study code, which tested on LMAX exchange, and with Quik datafeed. And I have some questions on events, which occurred with orders and positions per 1 lot.
1. Why event Positions_Deleted called every tick if EOG enabled, and every new bar if EOG disabled? Doesn't matter, there was deleted position or not, there is a current some position, or not.
3. Why after position was opened, Positions_Changed event called every tick (if EOG enabled)?
2. Why never called Orders_Deleted event?
4. Why event Orders_Changed called several times if order was changed only once?
Attachments
_bug_Study02_tradeManager.pln
(2.65 KiB) Downloaded 1206 times

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

Re: TradeManager events questions.

Postby Henry MultiСharts » 01 May 2015

Hello zysmn,

TradeManager receives the information regarding the orders from the order and position tracker only after TradeManager.ProcessEvent() is called. If it is called in CalcBar (your case) then the events you have subscribed to will be received only upon the next calculation (tick by tick with IOG=On, on bar close with IOG=Off). In order to call this event more often you can use RecalcLastBarAfter:

Code: Select all

protected override void CalcBar()
{
if (Bars.LastBarOnChart)
ExecControl.RecalcLastBarAfter(TimeSpan.FromSeconds(0.5));
TradeManager.ProcessEvents();
}

zysmn
Posts: 68
Joined: 27 Feb 2014
Has thanked: 7 times
Been thanked: 4 times

Re: TradeManager events questions.

Postby zysmn » 05 May 2015

Hello Henry,
Thank you for your answer, but I didn't understood to which question it's applies.
I do not want more often, I want more rarely. "MultiCharts.NET Programming Guide" says, that
event TItemsChanged<T> Deleted; - an event that is generated when the current elements of
the collection have been removed. For example, for positions it means that it has been closed or has become Flat.
But in fact event Positions_Deleted generated every tick, whatever was the positions deleted or not.
For other events approximately same situation: they generated more often than described in "MultiCharts.NET Programming Guide".

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

Re: TradeManager events questions.

Postby Henry MultiСharts » 05 May 2015

zysmn,

TradeManager subscribes to all trading events. If you are running autotrading on multiple charts and/or also place orders manually - you will receive all of these events. You can have a look at the Order and Position Tracker window - you will get all of its updates in the code. You can check the vent itself to understand which strategy it is coming from. We have tested your strategy and it works as expected.

zysmn
Posts: 68
Joined: 27 Feb 2014
Has thanked: 7 times
Been thanked: 4 times

Re: TradeManager events questions.

Postby zysmn » 06 May 2015

Henry,
I clarified the situation a little.
In my case I'm using LMAX and QUIK plugins for test purpose, where signal connect only to the one chart (on LMAX chart in my case).
All spurious events generated by QUIK plugin without any action on the trade account. I suppose (but i'm not sure), these events begin occurs after any first deal at the Quik account in new trade session. (I suppose that, because yesterday evening all worked fine without any spurious events, but today i didn't check the situation before create first deal). After disconnecting Quik plugin, events stopped appearing.
Trading only from the LMAX account working fine.
Attachments
bug02_after.jpg
(736.94 KiB) Downloaded 1117 times
bug01_before.jpg
(732.79 KiB) Downloaded 1067 times

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

Re: TradeManager events questions.

Postby Henry MultiСharts » 06 May 2015

Henry,
I clarified the situation a little.
In my case I'm using LMAX and QUIK plugins for test purpose, where signal connect only to the one chart (on LMAX chart in my case).
All spurious events generated by QUIK plugin without any action on the trade account. I suppose (but i'm not sure), these events begin occurs after any first deal at the Quik account in new trade session. (I suppose that, because yesterday evening all worked fine without any spurious events, but today i didn't check the situation before create first deal). After disconnecting Quik plugin, events stopped appearing.
Trading only from the LMAX account working fine.
Please come to our live chat to demonstrate this behavior remotely 6.30 am - 12 pm EST.


Return to “MultiCharts .NET”