objects & trend lines

 
Hi,

I'm trying to draw a line, horizontal, on a chart, but I want a definate start and stop time within the same day. I'm currently using

ObjectCreate("msLow",OBJ_TREND,0,vWhen,msLow,vEnd,msLow);

The line draws ok, as a ray. But I only want a segment. If I edit the object and unclick "ray" it works great, until the chart is refreshed.

Is this possible to accomplish?

Thanks.
Mark
 
double lineThickness = 1 / (0.00001+MathPow(10, Digits+1));
ObjectCreate("drawHline",OBJ_RECTANGLE,0,Time[15],High[15],Time[5],High[15]+lineThickness);
ObjectSet("drawHline",OBJPROP_COLOR,White);
 
flexie you will have to adjust the thickness of the line to suit the time frame, take care.

ObjectDelete("drawHline");
int iExtra=0;
if(Period()<PERIOD_H1) iExtra+=1;
double lineThickness = 1 / (0.00001+MathPow(10, Digits+iExtra));
ObjectCreate("drawHline",OBJ_RECTANGLE,0,Time[15],High[15],Time[5],High[15]+lineThickness);
ObjectSet("drawHline",OBJPROP_COLOR,White);
 
yup, it works great. thanks. Just kinda surprised that the "ray" switch can't be flipped from a coding point of view, as it can be manually editted later. Oh well.
Reason: