Syntax
public HighestBar(DataSeries source, int period, string description)
public static HighestBar Series(DataSeries source, int period)
public static double Value(int bar, DataSeries source, int period)
Parameter Description
source |
The source DataSeries |
period |
Lookback period |
Description
Returns the bar in which highest value of the Price Series for the specified
period was recorded.
See also:
LowestBar
Interpretation
(See
Highest)
Remarks
- If more than one bar has precisely the same Highest value, then HighestBar returns the most recent bar, i.e., the bar with the latest date/time.
- See HighestBar2 in TASCIndicators to return the HighestBar having the earliest date/time.
Calculation
Looks back the specified number of periods from the specified Bar and returns the Bar number with the highest price within that period.
Example
using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using WealthLab;
using WealthLab.Indicators;
namespace WealthLab.Strategies
{
public class MyStrategy : WealthScript
{
protected override void Execute()
{
// Has the 200 day high ocurred within the past 20 bars?
double n = 0;
for(int bar = 200; bar < Bars.Count; bar++)
{
n = HighestBar.Series( High, 200 )bar;
if( bar - n <= 20 )
SetBackgroundColor( bar, Color.LightGray );
}
}
}
}