Compare two indicators

 
Hi, on mt4 it is possible to combine two indicators in the same window, for example the moving average on the standard deviation. But how is it possible, by programming, to compare the position of these two indicators with each other?
For example if the moving average is above the standard deviation or below. Should we create a unique indicator and use its buffers?
 
forextastic: for example the moving average on the standard deviation.

Drag the MA onto the SD window and select price as previous indicator.

 
forextastic: Hi, on mt4 it is possible to combine two indicators in the same window, for example the moving average on the standard deviation. But how is it possible, by programming, to compare the position of these two indicators with each other? For example if the moving average is above the standard deviation or below. Should we create a unique indicator and use its buffers?

To do it programmatically, you have to "program" it.

One would copy the Standard Deviation values into an array and then apply a moving average on the array with iMAOnArray() to obtain the average of the Standard Deviation. Then one would compare the two values.

This is however, not the most efficient. The more efficient way would be to code something using incremental calculations, but that might be too mathematical for must users.

iMAOnArray - Technical Indicators - MQL4 Reference
iMAOnArray - Technical Indicators - MQL4 Reference
  • docs.mql4.com
iMAOnArray - Technical Indicators - MQL4 Reference
 

You must make an indicator which makes the calculation properly – so calculate STD and then calculate MA on those calculated buffer. I think it can be done in the simple indicator – just must be programmed properly.  Then you can compare them as you want.