(1) Assuming I do 20 DrawObjects at constant intervals ( N1 and N2 ) on chart. Which of the following methods is more preferable in terms of CPU and RAM intensive?
int N1 = 4;
int N2 = 20;
double p1 = { do something here};
[Method1 ] :
// will be from x01 to x40
x01.Set = (p1);
x02.Set = (x01[0]+TickSize*N1);
x03.Set = (x02[0]+TickSize*N2);
x04.Set = (x03[0]+TickSize*N1);
.
.
x39.Set = (x38[0]+TickSize*N2);
x40.Set = (x39[0]+TickSize*N1);
DrawRegion("a01", startBarsAgo, endBarsAgo, x01, x02, Color.Transparent, Color.Blue, 10);
DrawRegion("a02", startBarsAgo, endBarsAgo, x03, x04, Color.Transparent, Color.Blue, 10);
DrawRegion("a20", startBarsAgo, endBarsAgo, x39, x40, Color.Transparent, Color.Blue, 10);
[Method 2] :
// will be from x1 to x40
double x01 = (p1);
double x02 = (x01+TickSize*N1);
double x03 = (x02+TickSize*N2);
double x04 = (x03+TickSize*N1);
.
.
double x39 = (x38+TickSize*N2);
double x40 = (x39+TickSize*N1);
DrawRectangle("b01", false, startBarsAgo, x01, endBarsAgo, x02, Color.Transparent, Color.Blue, 10);
DrawRectangle("b02", false, startBarsAgo, x03, endBarsAgo, x04, Color.Transparent, Color.Blue, 10);
DrawRectangle("b20", false, startBarsAgo, x39, endBarsAgo, x40, Color.Transparent, Color.Blue, 10);
[Method 3] :
DrawRectangle("c01", false, startBarsAgo, p1, endBarsAgo, p1+TickSize*4 , Color.Transparent, Color.Blue, 10);
DrawRectangle("c02", false, startBarsAgo, p1+TickSize*24, endBarsAgo, p1+TickSize*28 , Color.Transparent, Color.Blue, 10);
DrawRectangle("c20", false, startBarsAgo, p1+TickSize*340, endBarsAgo, p1+TickSize*344, Color.Transparent, Color.Blue, 10);

Comment