When I use the chart data series, the plots are correct and the region is drawn.
When I use the secondary data series, the plots are correct, but the region is not drawn.
Is there something wrong with the code below that prevents the region from being drawn?
Code:
if (State == State.SetDefaults) {[INDENT] UseHigherTF = false; TF1 = 5; TF1Type = Data.BarsPeriodType.Minute; Period = 5; ChannelBrush = Brushes.Black; ChannelOpacity = 50; AddPlot(Brushes.Orange, "UpperLine"); AddPlot(Brushes.Orange, "LowerLine"); Plots[0].Width = 2; Plots[0].Brush = Brushes.Black; Plots[1].Width = 2; Plots[1].Brush = Brushes.Black;[/INDENT] } else if (State == State.Configure) {[INDENT] if(UseHigherTF == true) {[/INDENT][INDENT=2]AddDataSeries(TF1Type, TF1);[/INDENT][INDENT]} SetZOrder(-1);[/INDENT] } else if (State == State.DataLoaded) {[INDENT] if(UseHigherTF == true) {[/INDENT][INDENT=2] SMMA1 = smittySMMA(Highs[1], Period); SMMA2 = smittySMMA(Lows[1], Period);[/INDENT][INDENT] } else {[/INDENT][INDENT=2] SMMA1 = smittySMMA(Highs[0], Period); SMMA2 = smittySMMA(Lows[0], Period);[/INDENT][INDENT] }[/INDENT] } protected override void OnBarUpdate() {[INDENT] if(CurrentBars[0] < Period) { return; } if(UseHigherTF == true) {[/INDENT][INDENT=2]if(CurrentBars[1] < Period) { return; }[/INDENT][INDENT]} Values[0][0] = SMMA1[0]; Values[1][0] = SMMA2[0]; Draw.Region(this, "MA Channel", CurrentBar, 0, SMMA1, SMMA2, null, ChannelBrush, ChannelOpacity);[/INDENT] }
Comment