SeriesData.Count is egual to Number of bar in a chart? then is egual to CurrentBar, is correct?
i see code of nt8 @Swing.cs...look this piece of code:
public int SwingLowBar(int barsAgo, int instance, int lookBackPeriod)
{
if (instance < 1)
throw new Exception(string.Format(NinjaTrader.Custom.Resourc e.SwingSwingLowBarInstanceGreaterEqual, GetType().Name, instance));
if (barsAgo < 0)
throw new Exception(string.Format(NinjaTrader.Custom.Resourc e.SwingSwingLowBarBarsAgoGreaterEqual, GetType().Name, barsAgo));
if (barsAgo >= Count)
throw new Exception(string.Format(NinjaTrader.Custom.Resourc e.SwingSwingLowBarBarsAgoOutOfRange, GetType().Name, (Count - 1), barsAgo));
Update();
for (int idx=CurrentBar - barsAgo - Strength; idx >= CurrentBar - barsAgo - Strength - lookBackPeriod; idx--)
{
if (idx < 0)
return -1;
if (idx >= swingLowSwings.Count)
continue;
if (swingLowSwings.GetValueAt(idx).Equals(0.0))
continue;
if (instance == 1) // 1-based, < to be save
return CurrentBar - idx;
instance--;
}
return -1;
}
if (idx >= swingLowSwings.Count)
continue;
how it's possible that idx >=swingLowSwings.Count ?
(swingLowSwings is series Data...then is egual to CurrentBar..
Are correct? ..and in
for (int idx=CurrentBar - barsAgo - Strength; idx >= CurrentBar - barsAgo - Strength - lookBackPeriod; idx--)
idx can to be only lower of CurrentBar
Then why there is in a code :
if (idx >= swingLowSwings.Count)
continue;
i don't understand this :\
Comment