I like to make a line x bar back(to the left) from the monthly separator in the code below
When i run the code it show that line too many bars to the right like in the picture below.
I want it to show at the beginning of the monthly separator like below.
How do i automate it so it starts at the right point and make that line for every monthly separator?
It works if i use Time[j+6], but need it to be automatic
Thank u for ur reply in advance!
Inserted Code
int start() { int j=TimeMonth(Time[Bars-1]); string name; datetime d; string ObjName = "LineFromMonthlySeparator"; for (int i=Bars-1;i>0;i--) { d = Time[i]; if (TimeMonth(d) !=j) { j=TimeMonth(d); Comment(i); Sleep(100); name="vline"+IntegerToString(i); ObjectDelete(name); ObjectCreate(name,OBJ_VLINE,0,d,0); //This is the part that create the line to the left of the monthly separator ObjectCreate(ObjName,OBJ_RECTANGLE,0,Time[j],0.99430,Time[j+16],0.99480); ObjectSet(ObjName,OBJPROP_COLOR,Tomato); ChartRedraw(); } } } // Start
When i run the code it show that line too many bars to the right like in the picture below.
I want it to show at the beginning of the monthly separator like below.
How do i automate it so it starts at the right point and make that line for every monthly separator?
It works if i use Time[j+6], but need it to be automatic
Thank u for ur reply in advance!
Blindly following others will make you blind!