OnBarUpdate()
<< Click to Display Table of Contents >> OnBarUpdate() |
An event driven method which is called whenever a bar is updated. The frequency in which OnBarUpdate is called will be determined by the "Calculate" property. OnBarUpdate() is the method where all of your script's core bar based calculation logic should be contained.
Notes: •For multi-timeframe and instrument scripts, the OnBarUpdate method is called for each Bars object of a strategy. You MUST filter for the exact bar update events using the "BarsInProgress" property you want your system logic to execute against. •Hosted indicators will need to be accessed by the hosting script to ensure OnBarUpdate functionality. This can be done by: 1) Calling Update on the hosted indicator within the host script, 2) Including a plot in the hosted indicator and accessing the plot in the host script, 3) Including a plot in the hosted indicator and adding the indicator to the chart with AddChartIndicator (strategies only) |
The primary Bars object time frame (period type and interval). |
|
Determines how often OnBarUpdate() is called for each bar. |
|
The total number of bars or data points. |
|
A number representing the current bar in a Bars object that the OnBarUpdate() method in an indicator or strategy is currently processing. |
|
Determines if a Data Series is required for calculating this NinjaScript object. |
|
Indicates if the incoming tick is the first tick of a new bar. |
|
Determines if the specified bar series is using Break at EOD. |
|
Indicates the specified bar series is using Tick Replay. |
|
Forces the OnBarUpdate() method to be called so that indicator values are updated to the current bar. |
This method does not return a value.
protected override void OnBarUpdate()
{
}
Tip: The NinjaScript code wizards automatically generates the method syntax for you. |
protected override void OnBarUpdate() |