Been noticing a recurring issue with custom order flow indicators freezing the platform right at the New York open or during massive news events. Most of the time it happens because developers are dumping heavy mathematical calculations directly inside the OnRender method synchronously
When you are processing raw tick data or building custom footprint visuals you have to remember that OnRender is called constantly by the UI thread to update the graphics. If you bog it down with volume aggregations or complex bid ask delta loops your whole chart simply locks up and you miss the move. A much better approach we use in low-latency environments is to completely decouple the data ingestion from the drawing logic. You should calculate your cumulative delta or volume nodes dynamically inside OnMarketData and store those pre-calculated values in a lightweight generic List or a Dictionary. Then when OnRender fires it literally just reads the cached state and draws the rectangles or text instantly without doing a single drop of math. It sounds basic but separating state calculation from visual rendering will drop your CPU load from 80% to something barely noticeable even when the tape is flying, just a quick architectural tip for anyone building custom volumetric tools who is tired of their charts freezing up.
Come on man. Don’t give all the secrets away.
![]()
And you should probably consider using lock() or concurrent data structures during calculations to ensure those data structures aren’t being updated in the middle of a render. This commonly causes indicators to crash with missing dictionary keys with basic dictionaries.
Haha, fair point, I tried to keep the initial concept high-level without diving deep into thread safety mechanics so I wouldn’t scare off the beginners, but you are absolutely right to point that out for anyone actually implementing this
If you are decoupling data from the UI thread you essentially must use a ConcurrentDictionary or implement explicit lock objects before reading the cache inside OnRender. Otherwise the exact moment the market data thread writes while the UI thread is looping you get a collection modified exception and the whole thing crashes anyway, good looking out adding that caveat to the thread.