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()
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
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
Cheers
Stu

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
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