NinjaScript > Language Reference > Strategy >

Advanced Event Driven Programming Concepts

Print this Topic Previous pageReturn to chapter overviewNext page

Advanced event-driven strategy programming is reserved for EXPERIENCED programmers.

 

NinjaTrader is unlike traditional strategy development platforms in that it is not limited to processing your strategy logic on a bar by bar basis. NinjaTrader is a true real-time trading platform and thus can be driven by real-time events.

 

In addition to the OnBarUpdate() and Initialize() methods, NinjaScript exposes the following advanced event-driven methods:

 

 

OnConnectionStatus() - Called when a connection state changes
OnExecution() - Called when a strategy generated order is filled
OnFundamentalData() - Called on any change in fundamental data
OnMarketData() - Called on any change in a level 1 market data stream
OnMarketDepth() - Called on any change in a level 2 market data stream
OnOrderUpdate() - Called when a strategy generated order changes state
OnPositionUpdate() - Called when a strategy generated position changes
OnStartUp() - Called once when a script first starts up
OnTermination() - Called once when a script is terminated