I have this code and it work fine, drawing a vertical line at 10:00 and another vertical line at 20:00, but if i set the time to e.g. 7:00 and 20:00 it only draw the 20:00 line.
Can anyone tell me what's wrong?
Can anyone tell me what's wrong?
Inserted Code
extern int iHour1 = 10; extern int iHour2 = 20;
Inserted Code
if(TimeHour(Time[i])==iHour1 && TimeMinute(Time[i])==0)
{
x++;
ObjectCreate("Time" + x,OBJ_VLINE,0,Time[i],High[i]);
ObjectSet("Time" + x,OBJPROP_COLOR,Red); // Color value to set/get object color.
ObjectSet("Time" + x,OBJPROP_STYLE,STYLE_DOT); // Value is one of STYLE_SOLID, STYLE_DASH, STYLE_DOT, STYLE_DASHDOT, STYLE_DASHDOTDOT constants to set/get object line style.
ObjectSet("Time" + x,OBJPROP_WIDTH,1); // Integer value to set/get object line width. Can be from 1 to 5.
ObjectSet("Time" + x,OBJPROP_BACK,true); // Boolean value to set/get background drawing flag for object. (for example "true" will hide the value at the bottom of the chart.)
}
else
{
if(TimeHour(Time[i])==iHour2 && TimeMinute(Time[i])==0)
{
x++;
ObjectCreate("Time" + x,OBJ_VLINE,0,Time[i],High[i]);
ObjectSet("Time" + x,OBJPROP_COLOR,Yellow); // Color value to set/get object color.
ObjectSet("Time" + x,OBJPROP_STYLE,STYLE_DOT); // Value is one of STYLE_SOLID, STYLE_DASH, STYLE_DOT, STYLE_DASHDOT, STYLE_DASHDOTDOT constants to set/get object line style.
ObjectSet("Time" + x,OBJPROP_WIDTH,1); // Integer value to set/get object line width. Can be from 1 to 5.
ObjectSet("Time" + x,OBJPROP_BACK,true); // Boolean value to set/get background drawing flag for object. (for example "true" will hide the value at the bottom of the chart.)
}
} Blindly following others will make you blind!