![]() |
|
|||||||
| Indicator Development Support for the development of custom indicators using NinjaScript. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Member
Join Date: Jul 2011
Posts: 38
Thanks: 12
Thanked 7 times in 4 posts
|
What does the Bars property/field refer to?
Does it refer to the BarsArray[BarsInProgress] for the current call to OnBarUpdate()? That is, does BarsArray[BarsInProgress] == Bars? Can I substitute one for the other or do they refer to different objects? |
|
|
|
|
|
#2 |
|
NinjaTrader Customer Service
Join Date: Apr 2010
Location: Denver, CO, USA
Posts: 4,858
Thanks: 162
Thanked 579 times in 570 posts
|
Bars represents the data that is being processed by your script:
http://www.ninjatrader.com/support/h...s/nt7/bars.htm These are used to find the BarsSinceSession, etc BarsInProgress refers to the current call on OnBarUpdate related to the series that may be added, where BarsInProgress == 0 is the primary data series, and BarsInProgress == 1 would be an added data series.
Matthew
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Member
Join Date: Jul 2011
Posts: 38
Thanks: 12
Thanked 7 times in 4 posts
|
So that's my question, does the Bars property always refer to the primary data series? Or does it refer to the current data series that is being handled by OnBarUpdate()?
|
|
|
|
|
|
#4 |
|
NinjaTrader Customer Service
Join Date: Apr 2010
Location: Denver, CO, USA
Posts: 4,858
Thanks: 162
Thanked 579 times in 570 posts
|
The Data Series that is being handled by OnBarUpdate
If you were to check Bars.x in OnBarUpdate, you would get multiple calls for each OBU call. If you wanted to check for only one OBU call, you would need to check for Bars.x in a BIP filter: Code:
protected override void OnBarUpdate()
{
// This will be called twice as per each OBU call
Print("BIP : " + Instrument.FullName + " | Bars : " + Bars.BarsSinceSession);
// These will be called only when that BIP is called
if(BarsInProgress == 0)
{
Print("BIP 0 : " + Instrument.FullName + " | Bars : " + Bars.BarsSinceSession);
}
if(BarsInProgress == 1)
{
Print("BIP 1 : " + Instrument.FullName + " | Bars : " + Bars.BarsSinceSession);
}
}
Matthew
NinjaTrader Customer Service |
|
|
|
|
|
#5 |
|
Member
Join Date: Jul 2011
Posts: 38
Thanks: 12
Thanked 7 times in 4 posts
|
So from within OnBarUpdate(), BarsArray[BarsInProgress] == Bars, no?
|
|
|
|
|
|
#6 |
|
NinjaTrader Customer Service
Join Date: Apr 2010
Location: Denver, CO, USA
Posts: 4,858
Thanks: 162
Thanked 579 times in 570 posts
|
Yes, that would refer to the current data that is being processed in OBU()
Matthew
NinjaTrader Customer Service |
|
|
|
![]() |
| Tags |
| bars, barsarray, barsinprogress, onbarupdate |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Triggering OnBarUpdate when their is no more bars | freewind | General Programming | 3 | 12-19-2011 03:54 AM |
| Refer to manually made chart object | Steven000 | Market Analyzer | 1 | 08-29-2010 11:42 AM |
| How to identify the last OnBarUpdate() call from history bars? | 51friend | Indicator Development | 3 | 06-08-2010 08:10 AM |
| Conditional Bars Object for Indicators | Ralph | Version 7 Beta General Questions & Bug Reports | 15 | 05-28-2010 11:47 AM |
| Bars object question | The Kid | Strategy Development | 3 | 11-05-2008 11:09 AM |