AddPlot(Brushes.Chartreuse, "H_Avg");
AddPlot(Brushes.OrangeRed, "L_Avg");
AddPlot(Brushes.Aqua, "Max");
AddPlot(Brushes.DarkMagenta, "Min");
AddPlot(Brushes.Yellow, "MidLine");
AddPlot(Brushes.Black, "TrendLine");
}
else if (State == State.Configure)
{
max = MAX(High, Period_M);
min = MIN(Low, Period_M);
mid = new Series<double>(this);
}
}
protected override void OnConnectionStatusUpdate(ConnectionStatusEventArgs connectionStatusUpdate)
{
}
protected override void OnMarketData(MarketDataEventArgs marketDataUpdate)
{
}
protected override void OnBarUpdate()
{
if(CurrentBar < Period_B)
return;
double max0 = max[0];
double min0 = min[0];
mid[0] = (((max0-min0) * 0.5 )+ min0);
H_Avg[0] = SMA(EMA(High, Period_B), Period_S)[0];
L_Avg[0] = SMA(EMA(Low, Period_B), Period_S)[0];
Max[0] = max0;
Min[0] = min0;
MidLine[0] = SMA(mid, Period_S)[0];
TrendLine[0] = EMA(Median, 2*Period_M)[0];
if(MidLine[0] > TrendLine[0])
{
Draw.Region(this, "Cloud1" + CurrentBar, CurrentBar, 0, MidLine, TrendLine, null, Brushes.Cyan, 30);
}
else if(MidLine[0] <= TrendLine[0])
{
Draw.Region(this, "Cloud1" +CurrentBar, CurrentBar, 0, MidLine, TrendLine, null, Brushes.LightPink, 30);
}
}
What am I doing wrong in the code?
DaveN

Comment