NinjaScript > Educational Resources >
The building blocks of any automated trading system are indicators. NinjaScript allows you to develop custom indicators in rapid time. A few key points are:
Custom indicator development follows a logical progression.
The Initialize() method is called once before any initial calculation triggered by an update bar event. This method is used to configure the indicators plots, lines and properties. The wizard will generate the required NinjaScript code for this method for most cases.
The OnBarUpdate() method is called with either with each incoming tick or on the close of each bar depending on how you deploy the indicator at run time. Your core indicator calculation logic is contained within this method.
The NinjaScript Editor will perform both syntax and semantic checks and list any errors at the bottom of the NinjaScript Editor. If there are logic problems with your indicator, they will be listed in the Log tab of the NinjaTrader Control Center during run time. You can use the Print() method within your script to help debug your code. Output will be sent to the NinjaTrader Output window.
Once the coding effort is completed, you must then compile the indicator (several second process) directly from the NinjaScript Editor.
The completed indicator is now available through any window that can use an indicator such as a Chart window.
All internal NinjaTrader indicators come with full source code and can be viewed within the NinjaScript Editor. Please review the tutorials within this section for detailed walk throughs of custom indicator development.