ninjatrader-strategy-dev_skill

This skill helps you develop and debug NinjaTrader 8 strategies with real-time best practices for speed, reliability, and memory efficiency.
  • C#

0

GitHub Stars

1

Bundled Files

2 months ago

Catalog Refreshed

4 months ago

First Indexed

Readme & install

Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.

Installation

Preview and clipboard use veilstrat where the catalogue uses aiagentskills.

npx veilstrat add skill mkalhitti-cloud/universal-or-strategy --skill ninjatrader-strategy-dev

  • SKILL.md13.8 KB

Overview

This skill provides NinjaTrader 8 strategy development patterns focused on high-performance trading with C# on .NET Framework 4.8. It highlights real-time price handling, unmanaged order control, memory-efficient coding, and rate-limited order modifications to keep live trading reliable and fast. Use it to avoid common real-time bugs and to harden strategies for production.

How this skill works

The guidance inspects common hot-paths (OnMarketData, OnBarUpdate, OnOrderUpdate) and prescribes efficient patterns: tick-level live price tracking, cached indicator values, circular buffers, and pooled StringBuilder logging. It also defines unmanaged order submission and stop/target management with rate-limiting and disconnect detection. The patterns include safety checks, error handling, and performance targets to validate behavior under live feed conditions.

When to use it

  • Implementing or debugging NinjaScript strategies for live execution
  • Replacing Close[0]-dependent logic with tick-level updates
  • Building unmanaged order workflows and robust stop management
  • Optimizing memory and CPU in high-frequency or long-running strategies
  • Hardening strategies for broker/exchange rate limits and disconnects

Best practices

  • Use OnMarketData (MarketDataType.Last) for live decisions; avoid Close[0] in hot paths
  • Cache indicator results once per bar and reference cached values in OnMarketData
  • Rate-limit order modifications (e.g., 1s minimum) to comply with exchange rules
  • Use fixed-size collections or circular buffers; clean up dictionaries when orders complete
  • Pool StringBuilder instances for logging to reduce allocations and GC pressure
  • Validate stop/limit prices before submission and include null/bars checks

Example use cases

  • Trailing stop updates using live ticks and cached ATR to avoid delayed bar-close updates
  • Fully unmanaged entry + stop orders for manual control with SubmitOrderUnmanaged and ChangeOrder
  • Disconnect handling that flattens positions after stale tick detection (e.g., >5s)
  • Memory-stable long-running strategies using circular buffers and StringBuilder pooling
  • High-frequency decision logic meeting OnMarketData <1ms by avoiding heavy computations in the tick path

FAQ

Close[0] updates only at bar close; using it delays stop changes and can lose significant profit. Use OnMarketData or GetLivePrice() fallback instead.

How do I avoid excessive order modifications?

Implement a CanModifyOrder() rate limiter (timestamp + minimum delay) and only call ChangeOrder when price warrants and the limiter allows.

Built by
VeilStrat
AI signals for GTM teams
© 2026 VeilStrat. All rights reserved.All systems operational