My goal is to return the BarNumber of Bars.High.Highest(100) for ex.
Is there anything like:
Code: Select all
MyBarNumber = Bars.High.Highest(100).BarNumber
Cheers,
R.
Code: Select all
MyBarNumber = Bars.High.Highest(100).BarNumber
I don't know of such a feature. But you can code this with a loop yourself. For example:My goal is to return the BarNumber of Bars.High.Highest(100) for ex.
Is there anything like:Code: Select all
MyBarNumber = Bars.High.Highest(100).BarNumber
Code: Select all
int highestBar = 0;
double highestHigh = 0;
protected override void CalcBar()
{
if (Bars.LastBarOnChart)
{
HighestHighCalculation(100, ref highestBar, ref highestHigh);
Output.WriteLine("Highest high is: {0}, this happened on bar #{1}",
highestHigh, highestBar);
}
}
private void HighestHighCalculation(int barsBack, ref int highestBar, ref double highestHigh)
{
for (int i = 0; i < barsBack; i++)
{
if (Bars.FullSymbolData.High[i] > highestHigh)
{
highestHigh = Bars.FullSymbolData.High[i];
highestBar = Bars.FullSymbolData.Count - i;
}
}
}
Code: Select all
Highest high is: 3412, this happened on bar #405
Code: Select all
int _hh = 0;
Bars.High.Highest(100, out _hh, 0);
Code: Select all
Dim BarBack As Integer = 0
Bars.High.Highest(100, BarBack , 0)