Wrapping an Indicator

 

For certain reasons (such as programmatically combining two compiled indicators), I'd like to wrap an indicator in a new indicator and use the iCustom call to get the values to paint on the screen. For example, I have an indicator called CCI2 which basically has an iCustom call to CCI but paints on the screen just like using the CCI indicator.


Has anyone done this or have sample code on making this work? I assume I'd basically need to pull the entire indicator data buffer to the "new" one, but not quite sure how to do this, since I thought iCustom just returns a single variable.


Thanks!

 

In iCustom, https://docs.mql4.com/indicators/iCustom, the mode represents each of the buffers. So iCustom will return a single variable and if your indicator has 2 values, then you call iCustom twice, once for each line with the mode set appropriately...(0 and 1).


I asusme you have seen https://docs.mql4.com/indicators/iCCI.

hth

V