Nimoonphob noobiris:
So I'm trying to make a bullish/bearish divergence here but halfway through, the line on the MACD is just a horizontal.
Would it be possible to make it the same as the trendline in the chart as in the attached picture?
use OBJ_TREND
https://www.mql5.com/en/docs/constants/objectconstants/enum_object/obj_trend
Documentation on MQL5: Constants, Enumerations and Structures / Objects Constants / Object Types / OBJ_TREND
- www.mql5.com
OBJ_TREND - Object Types - Objects Constants - Constants, Enumerations and Structures - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
Paul Anscombe #:
use OBJ_TREND
https://www.mql5.com/en/docs/constants/objectconstants/enum_object/obj_trend
Oh I forgot to provide the code, well I actually did use OBJ_TREND tho I'll try to test again..
ObjectCreate( _Symbol, "trendline", OBJ_TREND, ChartWindowFind(0,"MACD(12,26,9)"), PriceInfo[0].time, myMACD(1,0), PriceInfo[1].time, myMACD(2,1) ); ObjectSetInteger(0,"trendline",OBJPROP_COLOR,Green); ObjectSetInteger(0,"trendline",OBJPROP_STYLE,STYLE_SOLID); ObjectSetInteger(0,"trendline",OBJPROP_WIDTH,1);
What if
ChartWindowFind(0,"MACD(12,26,9)"),fails? It would be better set in OnInit() and use shortname, see here: https://www.mql5.com/en/docs/chart_operations/chartwindowfind
Documentation on MQL5: Chart Operations / ChartWindowFind
- www.mql5.com
ChartWindowFind - Chart Operations - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
give the buffer value a variable instead of a constant .
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
So I'm trying to make a bullish/bearish divergence here but halfway through, the line on the MACD is just a horizontal.
Would it be possible to make it the same as the trendline in the chart as in the attached picture?