Properly receiving events from manual trading actions
Posted: May 17 2024
I would like to have a signal that records all activity occurring while trading manually.
I need to receive the events from TradeManager, and specially order addition, deletion and modification and current position, pnl etc.
This is partially explained in the ChartToolBar trading strategy, however, that strategy contains a timer that calls the "TradeManager.ProcessEvents" method.
Is this the recommended way ? Events are not processed unless I manually call that function with a timer. Please confirm that this is the right way or show a proper way.
Second Issue and question:
OrdersAdded/Changed/Deleted events are not generated properly:
1. When adding a limit order, the I get a call to OrderAdded and OrderChanged. Two calls for a single order
2. When deleting a limit order, I get two times OrderChanged but never OrderDeleted event. Two calls for a single deletion and both are OrderChanged and there's no OrderDeleted. This seems like a bug. Please confirm.
Thank you.
I need to receive the events from TradeManager, and specially order addition, deletion and modification and current position, pnl etc.
This is partially explained in the ChartToolBar trading strategy, however, that strategy contains a timer that calls the "TradeManager.ProcessEvents" method.
Code: Select all
protected override void CalcBar()
{
if (Bars.LastBarOnChart)
ExecControl.RecalcLastBarAfter(TimeSpan.FromSeconds(0.5));
}
protected override void OnRecalcLastBarAfterEvent()
{
TradeManager.ProcessEvents();
ExecControl.RecalcLastBarAfter(TimeSpan.FromSeconds(0.5));
}
Second Issue and question:
OrdersAdded/Changed/Deleted events are not generated properly:
1. When adding a limit order, the I get a call to OrderAdded and OrderChanged. Two calls for a single order
2. When deleting a limit order, I get two times OrderChanged but never OrderDeleted event. Two calls for a single deletion and both are OrderChanged and there's no OrderDeleted. This seems like a bug. Please confirm.
Thank you.