Long-time lurker, first post. I’m a NinjaTrader vendor and wanted to share
some of the harder SDK problems I solved while building Nexus Chart Trader,
in case it’s useful to anyone building similar tools.
Problem 1: Daily loss limits that survive NT restarts
The obvious approach (storing limits in instance variables) breaks the moment
a trader restarts NinjaTrader to reset their own limits. I solved this by
persisting locks to the Windows Registry with a static object lock to prevent
race conditions across multiple chart instances. SessionIterator detects new
trading sessions and clears them automatically no manual reset needed.
Problem 2: Duplicate brackets from multiple chart instances
When two NCT charts on the same instrument both receive ExecutionUpdate for
the same fill, they race and can submit duplicate SL/TP brackets. Fixed with
a ConcurrentDictionary owner-claim gate the first instance claims the
(account, instrument) key, the second skips. The claim releases after
reconciliation so the next fill works cleanly.
Problem 3: Per-frame SharpDX brush allocations
The button panel is a full SharpDX Direct2D overlay on OnRender(). Naive
brush creation per frame caused GC pressure. Solved with a pooled
Dictionary<uint, SolidColorBrush> keyed on ARGB brushes are reused
across frames and only disposed on chart close.
Problem 4: Forex Factory news calendar without hammering the API
News lock pulls from the FF XML feed and caches locally. On each load it
checks file age if under 61 minutes it reads from disk, otherwise
re-fetches. Prevents rate limiting while keeping the calendar fresh.
The panel also handles streamer mode (account name redaction), account
rotation with a cross-instance skip list, and a mobile WebUI over local
network. Happy to discuss any of the implementation details.