Download MetaTrader 5
To add comments, please log in or register
Publish your trading signal. Gain access to millions of traders!
Gerardo Bustos
746
Gerardo Bustos 2015.04.22 18:28 

Hello forum, good day.

How can a diagonal line be created in MQL4? I need to create a diagonal line (trend line) where the starting point is the Order Open Price level and acts as a support/resistance so I can check if the close price is above or below this line. Your help will be much appreciated.

 

Best regards and thank you in advance,

Gerardo 

Stuart Browne
5719
Stuart Browne 2015.04.23 00:32  
codeMolecules:

Hello forum, good day.

How can a diagonal line be created in MQL4? I need to create a diagonal line (trend line) where the starting point is the Order Open Price level and acts as a support/resistance so I can check if the close price is above or below this line. Your help will be much appreciated.

 

Best regards and thank you in advance,

Gerardo 

Hi Gerardo

All you need to do is create the object with OBJ_TREND, then set the various properties you want. You can find the properties here. So it would be something like:

ObjectCreate(chart_ID,name,OBJ_TREND,sub_window,time1,price1,time2,price2)

ObjectSetInteger(chart_ID,name,OBJPROP_COLOR,clr);
ObjectSetInteger(chart_ID,name,OBJPROP_STYLE,style);
ObjectSetInteger(chart_ID,name,OBJPROP_WIDTH,width);
ObjectSetInteger(chart_ID,name,OBJPROP_RAY,false);

 

 It's usually best to create the line in init() or a separate function that only gets called once. Then set the properties at the time you want the line to become visible at the correct location. And don't forget to delete it in the DeInit()

Gerardo Bustos
746
Gerardo Bustos 2015.04.23 00:44  
Filter:

Hi Gerardo

All you need to do is create the object with OBJ_TREND, then set the various properties you want. You can find the properties here. So it would be something like:

 

 It's usually best to create the line in init() or a separate function that only gets called once. Then set the properties at the time you want the line to become visible at the correct location. And don't forget to delete it in the DeInit()

Hello Stuart, thank you very much! I´ll give it a try.

I´ll send a private message to see if you can help me with a freelance job to create an Indicator I need to use in an EA.

 

Best regards,

Gerardo 

Stuart Browne
5719
Stuart Browne 2015.04.23 01:15  
codeMolecules:

Hello Stuart, thank you very much! I´ll give it a try.

I´ll send a private message to see if you can help me with a freelance job to create an Indicator I need to use in an EA.

 

Best regards,

Gerardo 

No worries mate :)

Cheers
Stu
/
To add comments, please log in or register