using System;
using System.Drawing;
using System.Linq;
using PowerLanguage.Function;
namespace PowerLanguage.Indicator
{
public class Donchian Channel : IndicatorObject
{
public Donchian Channel(object _ctx):base(_ctx)
{
n_bars = 5;
}
[Input]
public int n_bars { get; set; }
private IPlotObject plothigh, plotlow;
protected override void Create()
{
plothigh = AddPlot(new PlotAttributes("plothigh", EPlotShapes.Line, Color.Red));
plotlow = AddPlot(new PlotAttributes("plotlow", EPlotShapes.Line, Color.Red));
}
protected override void StartCalc()
{
}
protected override void CalcBar()
{
if(Bars.High[5] > 0 && Bars.Low[5] > 0)
{
plothigh.Set(Bars.High.Highest(n_bars));
plotlow.Set(Bars.Low.Lowest(n_bars));
}
}
}
}
|