What I believe I have identified is that there may be excess "synchronously forced" calls to OnRender across the system. Particularly around the position/order labels in ChartTrader mode may be causing excessive OnRender calls. Given that these forced calls to OnRender for every single indicator, every single drawing object across all the charts that have ChartTrader enabled (On or Hidden mode), and the calls are multiplied by the number of orders and for each order it appears to trigger for every OnOrderUpdate, the problem can grow exponentially if you have partial fills or scale into your positions in a way that creates new stop/target orders for example. e.g. the math:
OnRenderCalls = Orders * 3 * (DrawingObjects + Indicators) (*2 if Stop and Target are being affected a same time) [and this is happens in all ChartTrader charts]
I am curious if others see this kind of performance issue and/or if it's just so noticeable on my PC, while powerful is a few years old now. My charts "Hang" for a number of seconds around order movement, creation, canceling, fills, closing, etc. I do have some Indicators that I know are compute intensive, drawing shaded regions and such, but I have tried to develop them to be as efficient as possible. WIth that said, I've been able to duplicate this lag in SafeMode by just adding a handful of drawings and increasing the Order count to exacerbate the issue.
I have enclosed a custom indicator that displays some metrics around OnRender calls and "High bursts of Request per second". If you have encountered some of these issues, I encourage you to try this Indicator. Add it to a chart with ChartTrader on, and another window with ChartTrader off so you can see the total difference in OnRender calls over time. To test it at the extreme corner cases you can for example create some positions with an ATM 1 contract at a time, so you end up with multiple stop/target orders and then move the orders around, or watch as they trail the price to see if the RPS burst. Keep in mind that these stats are just the OnRender calls to the Debug Indicator, so this would be multiplied by the number of Drawing Objects and Indicators across your charts.
A sample of the statistics displayed (extreme case):
ADebug_OrdersExcessiveOnRender.cs

Comment