I wrote an indicator with 2 timeframes (stf,htf). The indicator is calculating many objects (swing, trends, signals, signals setups) and reder them on chart using OnRender. I am using 3 EMAs values (2 of htf, and 1 of stf), they are set as plots with colors and external properties. I can see these 3 plots correct values in the DataBox, but there is no displayed plots, as you can see below (SlowMA0, FastMA1, SlowMA1 are shown with the colors, and correct & in range values in Data Box, but not on Chart):
Here is the relevant code:
public int AddChartPlot(Brush brush, string name)
{
AddPlot(brush, name);
return Plots.Count()-1;
}
//...
protected override void OnStateChange()
{
switch (State)
{
//...
case State.Configure:
plotSlowMA0 = AddChartPlot(Brushes.Goldenrod, "SlowMA0");
plotFastMA1 = AddChartPlot(Brushes.White, "FastMA1");
plotSlowMA1 = AddChartPlot(Brushes.Blue, "SlowMA1");
//...
break;
//...
}
}
protected override void OnBarUpdate()
{
int stf = 0;
int htf = 1;
if (CurrentBars[stf] <= BarsRequiredToPlot || CurrentBars[htf] <= BarsRequiredToPlot) return;
if (BarsInProgress == stf || BarsInProgress == htf)
{
//...
SlowMA0[0] = EMA(BarsArray[stf],maPeriod1)[0];
FastMA1[0] = EMA(BarsArray[htf],maPeriod2)[0];
SlowMA1[0] = EMA(BarsArray[htf],maPeriod1)[0];
//...
}
protected override void OnRender(Gui.Chart.ChartControl chartControl, Gui.Chart.ChartScale chartScale)
{
if (!IsVisible || ChartBars.ToIndex < BarsRequiredToPlot) return;
//...
}
[Browsable(false)][XmlIgnore()] public Series<double> SlowMA0 { get { return Values[plotSlowMA0]; } }
[Browsable(false)][XmlIgnore()] public Series<double> FastMA1 { get { return Values[plotFastMA1]; } }
[Browsable(false)][XmlIgnore()] public Series<double> SlowMA1 { get { return Values[plotSlowMA1]; } }

Comment