I've done the following. Compiled successfully then I realized that the first DrawRectangle was plotted from the point I desired but not the second DrawRectangle.The worst case was my DrawRegion not even plotted. I must have made some mistakes. Your kind advice will be much appreciated! (My primary series is 6E 12-10 2 Renko and the secondary series is 6E 12-10 6 Renko)
Variables
private DataSeries Hiline0000;
private DataSeries Loline0000;
protected override void Initialize()
{
AddRenko("6E 12-10", 6, MarketDataType.Last);
Hiline0000 = new DataSeries (this);
Loline0000 = new DataSeries (this);
}
private DateTime startDateTime000a;
private DateTime endDateTime000a;
private DateTime startDateTime000b;
private DateTime endDateTime000b;
protected override void OnBarUpdate()
{
if(BarsInProgress ==0)
{
startDateTime000a = new DateTime(Time[0].Year, Time[0].Month, Time[0].Day, 8, 00, 0);
int startBarsAgo000a = GetBar( startDateTime000a);
double hh1a = High[startBarsAgo000a];
double ll1a = Low[startBarsAgo000a];
DrawRectangle("Reg01", false, startBarsAgo000a, hh1a, 0, ll1a, Color.Khaki, Color.Khaki, 4);
}
if(BarsInProgress ==1)
{
startDateTime000b = new DateTime(Times[1][0].Year, Times[1][0].Month, Times[1][0].Day, 8, 00, 0);
int startBarsAgo000b = GetBar( startDateTime000b);
double hh1b = Highs[1][startBarsAgo000b];
double ll1b = Lows[1][startBarsAgo000b];
DrawRectangle("Reg01b", false, startBarsAgo000b, hh1b, 0, ll1b, Color.Khaki, Color.Khaki, 4);
double hi0000 = (SUM(Highs[1],startBarsAgo000b)[0])/startBarsAgo000b;
double lo0000 = (SUM( Lows[1],startBarsAgo000b)[0])/startBarsAgo000b;
Hiline0000.Set (Instrument.MasterInstrument.Round2TickSize(hi0000 ));
Loline0000.Set (Instrument.MasterInstrument.Round2TickSize(lo0000 ));
DrawRegion("Reg0000a", startBarsAgo000b, 0, Hiline0000, Loline0000, Color.Transparent, Color.Pink, 5);
}
}

Comment