Chart.mqh lib

Ocelot
16
Ocelot  

Hello everyone,

I recently discovered the Include libs in MT4 with such gems as Chart.mqh. I see that it gives MT4 access to the MT5 function, ChartIndicatorAdd(). Yay! So my question is, iCustom() in MT4 seems to work slightly differently than in MT5 and I'm having trouble figuring how to get the handle for a custom indicator to pass to ChartIndicatorAdd() so that my EA can automatically add it to my chart. Ideally I'd like to embed a custom indicator in my EA using the "resource" functionality and have the EA use the indicator settings set by the user after the indicator has been added to the chart. Is this possible, and can anyone point me to an example of this in use or have any general advice? Thank you all very much! 

William Roeder
24609
William Roeder  
ggladden: . I see that it gives MT4 access to the MT5 function, ChartIndicatorAdd().
  1. Not listed in List of MQL4 Functions - MQL4 Reference
  2. Only place even mentioned in MQL4 Reference in the example code in ChartSaveTemplate - Chart Operations - MQL4 Reference and that code is obviously not MQL4 code:
    h=iCustom(sym,tf,"Examples\\Zigzag"); Not MQL4 code
Ocelot
16
Ocelot  
whroeder1:
  1. Not listed in List of MQL4 Functions - MQL4 Reference
  2. Only place even mentioned in MQL4 Reference in the example code in ChartSaveTemplate - Chart Operations - MQL4 Reference and that code is obviously not MQL4 code:
    h=iCustom(sym,tf,"Examples\\Zigzag"); Not MQL4 code
Upon further inspection of the Chart.mqh lib I see that there is a check in there that does define ChartIndicatorAdd() for MT4, but it always returns false, looks like it was just a convenience wrapper so this lib wouldn't break in MT4. Back to the drawing board!
Alain Verleyen
41237
Alain Verleyen  
ggladden:
Upon further inspection of the Chart.mqh lib I see that there is a check in there that does define ChartIndicatorAdd() for MT4, but it always returns false, looks like it was just a convenience wrapper so this lib wouldn't break in MT4. Back to the drawing board!
ChartIndicatorAdd() is not supported by mql4.
Kristina Suh
430
Kristina Suh  
Alain Verleyen:
ChartIndicatorAdd() is not supported by mql4.

i noticed that this is a post from 2017,  do you know if there is any update on MT4 with using the ChartIndicatorAdd()  or if there is another option /code that I can use.

I would like to add an indicator on my chart when loading the EA.
I also tried the template, but having issues with the EA loading properly with the template load.


thanks