Horizontal lines - page 6

 

Horizontal lines at certain price levels like 1.2310 & 1.2390

I want to draw horizontal lines at certian levels e.g. 1.2310, 1.2390 & 1.2410, 1.2490 and so on, but how do i get the exact price e.g. 1.2310 so i can draw my horizontal line there?

 

...

If you are looking for a coding example, here is one thread that might help you : https://www.mql5.com/en/forum/172989

 

Hi mladen,

Do you live in here

I have been there but didn't find anything, but i'm trying one more time.

Thanks!

 

Hi Georgebaker,

You can draw it by yourself using Horizontal Line button in metatrader

place the line on any space on the chart, double click on this line and move it to any price value. You can also do it by color or select the color of every line.

It is very easy.

Files:
 
newdigital:
Hi Georgebaker,

You can draw it by yourself using Horizontal Line button in metatrader

place the line on any space on the chart, double click on this line and move it to any price value. You can also do it by color or select the color of every line.

It is very easy.

Thanks newdigital, but i'm looking for mql4 code to make an indicator.

 

Just found some article with codes about how to code horizontal lines:

MQL4 Language for Newbies. Custom Indicators (Part 2) - MQL4 Articles

 

This is a good one, for newbies

Get back to you guys in here when i need it to repaint when i change time frames

Thanks newdigital

 

...

At the first post of this thread you have a grid builder indicator. It is drawing a series of horizontal lines. Here is how it does it :

for(I=LowPrice;I<=HighPrice;I++)

{

if (MathMod(I, GridS) == 0)

{

if (ObjectFind("Grid"+I) != 0)

{

ObjectCreate("Grid"+I, OBJ_HLINE, 0, Time[1], I/Divisor);

ObjectSet("Grid"+I, OBJPROP_STYLE, STYLE_SOLID);

ObjectSet("Grid"+I, OBJPROP_COLOR, MediumSeaGreen);

}

}

}

The part with "Object"... functions is the part that does the actual horizontal lines drawing. The part "I/Divisor" is assigning the price the horizontal line is drawn at

Georgebaker:
Hi mladen,

Do you live in here

I have been there but didn't find anything, but i'm trying one more time.

Thanks!
 
mladen:
At the first post of this thread you have a grid builder indicator. It is drawing a series of horizontal lines. Here is how it does it :
for(I=LowPrice;I<=HighPrice;I++)

{

if (MathMod(I, GridS) == 0)

{

if (ObjectFind("Grid"+I) != 0)

{

ObjectCreate("Grid"+I, OBJ_HLINE, 0, Time[1], I/Divisor);

ObjectSet("Grid"+I, OBJPROP_STYLE, STYLE_SOLID);

ObjectSet("Grid"+I, OBJPROP_COLOR, MediumSeaGreen);

}

}

}
The part with "Object"... functions is the part that does the actual horizontal lines drawing. The part "I/Divisor" is assigning the price the horizontal line is drawn at

Thank you mladen for the code.

I'll give it a try.

 

Horizonal Lines indicator 15 lines/Price/Color/Width/Style

Can some body put a delete in the code to delete lines previously made and make the program run just once and when opened and changed. Thanks, and here is the indicator and the Script.

horizontal_line_drawer__lbw3.mq4

horizontal_line_drawer__lbw3_script.mq4