EMA on EMA on EMA......

 

I'm trying to transfer an indicator from Intellicharts to MT4 to smooth out averages. Is it possible to duplicate the following?

EMA(10) On EMA(3) On EMA(7) On (O+H+L+C)/4

Thanks so much

 
With assumption you're a coder too, this is it's logic

define O,L,H,C

ma1=iMa period 7 mode ema of (O+H+L+C)/4

ma2=IMaonArray period 3 mode ema of ma1

ma3=IMaonArray period 10 mode ema of ma2

Somebody CMIIW
 

The standard Moving Average tool can do it, no coding required ( not OHLC/4 but HLCC/4)

Add MA indicator, EMA, period 7, Apply to: Weighted Close (HLCC/4), Style - color = none

Add MA Indicator EMA period 3, Apply to: "Previous Indicator's Data", Style - color = none

Add MA indicator EMA period 10, Apply to: "Previous Indicator's Data" Style - color = Red

Save a template for later application to another chart.

 
phy:

The standard Moving Average tool can do it, no coding required ( not OHLC/4 but HLCC/4)

Add MA indicator, EMA, period 7, Apply to: Weighted Close (HLCC/4), Style - color = none

Add MA Indicator EMA period 3, Apply to: "Previous Indicator's Data", Style - color = none

Add MA indicator EMA period 10, Apply to: "Previous Indicator's Data" Style - color = Red

Save a template for later application to another chart.

Hi phy, maybe you could help, I did as you said above, but I does not show "Previous Indicators Data" in the drop down for 'Apply to', do you perhaps know why?

Regards,

Joe

 
devilian1899 and phy:  Thanks for your help.  This forum is really supportive for new guys like me.  As I get better with this I'll be able to "Pay it forward" .  Cheers!
 

Birdwatcher:

Menu -- View -- Navigator -- Indicators (NOT custom Indicators)

There you will find the Moving Average (and some other indicators) that operate as stated above

Drag MA onto chart

Drag MA onto subwidnow of first MA, etc

 
phy:

Birdwatcher:

Menu -- View -- Navigator -- Indicators (NOT custom Indicators)

There you will find the Moving Average (and some other indicators) that operate as stated above

Drag MA onto chart

Drag MA onto subwidnow of first MA, etc

Thanks phy, that works well :))
 
Hello Everybody

I hope I am posting this in the right place, if not please direct me to the correct topic.

I am looking to write an Indicator the would give me the value of the difference between 2 EMA values,

I believe (like most people do) that if I get X value it will indicate a market direction.


Thank You
 
thelamden:
Hello Everybody

I hope I am posting this in the right place, if not please direct me to the correct topic.

I am looking to write an Indicator the would give me the value of the difference between 2 EMA values,

I believe (like most people do) that if I get X value it will indicate a market direction.


Thank You

Create a new indicator with one line and in a separate window with your metaeditor.

add
double ma1[];
double ma2[];
under
double ExtMapBuffer1[]
and under
int    counted_bars=IndicatorCounted();
you can add this code
   int i, maxlimit=Bars-counted_bars;
 
   for(i=0; i<maxlimit; i++) 
    {   
      ma1[i]=iMA(...); 
      ma2[i]=iMA(...); 
      ExtMapBuffer1[i]=ma1[i]-ma2[i];   
    }
Hope this helps
 
Thanks devilian1899,

I am not yet experienced, but from what you instructed me I have the following code

#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 Red
//---- buffers
double ExtMapBuffer1[];
double ma1[5];
double ma2[30];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0,ExtMapBuffer1);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int    counted_bars=IndicatorCounted();
   int i, maxlimit=Bars-counted_bars;
 
   for(i=0; i<maxlimit; i++) 
    {   
      ma1[i]=iMA(5); 
      ma2[i]=iMA(30); 
      ExtMapBuffer1[i]=ma1[i]-ma2[i];   
    }   
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
I am trying to get the value of the difference between EMA 5 and EMA 30, It is never more then +/- 50,

Notice that I entered the ma values in two locations, maybe thats why I get an error when compiling,

Thank you , your help is greatly appreciated
 
The iMA function has more arguments than you provide it with. Have a look.

https://docs.mql4.com/indicators/iMA