Download MetaTrader 5

MQL4 Horizontal Object

To add comments, please log in or register
Any problems with the code? Find solution in documentation!
mostafalotfi
185
mostafalotfi 2014.01.13 11:22 

Hi

could you please advise me how can i add an horizental line on the chart?

i tried

ObjectCreate("حد بالا", OBJ_HLINE, 0, Time[0], TL, 0, 0);
ObjectCreate("حد پايين", OBJ_HLINE, 0, Time[0], LL, 0, 0);
    

but, i dono how can i change the color and size of line

Simon Gniadkowski
Moderator
18001
Simon Gniadkowski 2014.01.13 11:45  
mostafa:

Hi

could you please advise me how can i add an horizental line on the chart?

i tried

but, i dono how can i change the color and size of line

The most important value for a Horizontal line ( _________________ ) is the price, the time value does not matter as long as it is >= 0, it only uses one set of coordinates, time1 and price 1

To set the colour and line width use ObjectSet() with OBJPROP_COLOR and OBJPROP_WIDTH

mostafalotfi
185
mostafalotfi 2014.01.13 12:41  
RaptorUK:

The most important value for a Horizontal line ( _________________ ) is the price, the time value does not matter as long as it is >= 0, it only uses one set of coordinates, time1 and price 1

To set the colour and line width use ObjectSet() with OBJPROP_COLOR and OBJPROP_WIDTH


Thank You RaptorUK

It works well

   ObjectCreate("حد بالا", OBJ_HLINE, 0, Time[0], TL, 0, 0);
   ObjectCreate("حد بالا دوم", OBJ_HLINE, 0, Time[0], TL+(500*Point), 0, 0);
   ObjectCreate("حد پايين", OBJ_HLINE, 0, Time[0], LL, 0, 0);
   ObjectCreate("حد پايين دوم", OBJ_HLINE, 0, Time[0], LL-(500*Point), 0, 0);
    
   ObjectSet("حد بالا",OBJPROP_COLOR,Orange);
   ObjectSet("حد بالا",OBJPROP_WIDTH,1);
   ObjectSet("حد پايين",OBJPROP_COLOR,Orange);
   ObjectSet("حد پايين",OBJPROP_WIDTH,1);
   ObjectSet("حد بالا دوم",OBJPROP_COLOR,Purple);
   ObjectSet("حد بالا دم",OBJPROP_WIDTH,1);
   ObjectSet("حد پايين دوم",OBJPROP_COLOR,Purple);
   ObjectSet("حد پايين دوم",OBJPROP_WIDTH,1);

   ObjectCreate("يک سوم اول", OBJ_HLINE, 0, Time[0], LL+((TL-LL)/3), 0, 0);
   ObjectSet ("يک سوم اول",OBJPROP_STYLE,STYLE_DASHDOT);
   ObjectCreate("يک سوم دوم", OBJ_HLINE, 0, Time[0], LL+(2*(TL-LL)/3), 0, 0);
   ObjectSet ("يک سوم دوم",OBJPROP_STYLE,STYLE_DASHDOT);
To add comments, please log in or register