Coding Problem

 

Hi everyone,

Could anybody tell me how in Metatrader 4 coding an expert one could draw a trendline from close of one time to close of another time ? eg: include in EA code to draw trendline from close at 15:00 to close at 18:00 ?

Thanks

 

forgot to say as its drawing from close to close this won't be a horizontal line most of the time but diagonal or sloped... can anyone show code to automate this ?

 

Take a look at the ObjectCreate function. The type would be OBJ_TREND and the first time and price would be the time and close of the first bar, the second time and price would be that of the second bar.

If you want it to be a ray, add ObjectSet( name, OBJPROP_RAY, true );

 

Hi 4xCoder, thanks for your input, exactly I was looking at the objectcreate function - I think maybe the ray setting will help as it wasn't drawing diagonally. I'm just having problem with the parameters and the order the times and prices go in. Thanks again

Reason: