How to display multiple moving average lines (a moving average with multiple periods) with a single moving average indicator?

tao zemin.
441
tao zemin.  
Dear all,
  How can I display multiple moving average lines (a moving average with multiple periods) with a single moving average indicator?
  Thanks a lot for your prompt reply.

  
Alain Verleyen
40995
Alain Verleyen  
tzm:
Dear all,
  How can I display multiple moving average lines (a moving average with multiple periods) with a single moving average indicator?
  Thanks a lot for your prompt reply.

  
Attach this indicator on a chart as many times as necessary with different parameters.
tao zemin.
441
tao zemin.  

Dear angevoyageur,  Thank you for your prompt reply. Let me clarify my question: Can I display multiple moving average lines by a single attachment of the moving average indicator?

 


Alain Verleyen
40995
Alain Verleyen  
tzm:

Dear angevoyageur,  Thank you for your prompt reply. Let me clarify my question: Can I display multiple moving average lines by a single attachment of the moving average indicator?

 


 

I don't think so. You have to use a Custom indicator for such things.
William Roeder
24188
William Roeder  
tzm: Can I display multiple moving average lines by a single attachment of the moving average indicator?
  1. "THE moving average indicator" has ONE period. Answer NO.
  2. Can you put "THE moving average indicator" on the chart multiple times with different periods, of course.
  3. Can a custom indicator can have multiple periods. Yes.
ali_h3
5
ali_h3  
Hello.
dear All..
I have no moving average in insert/indicators Tab... 
How can i active it ? thank you. 
chinaski
1046
chinaski  
tao zemin.:
Dear all,
  How can I display multiple moving average lines (a moving average with multiple periods) with a single moving average indicator?
  Thanks a lot for your prompt reply.

  

If you mean multiple lines (each with an own MA length) in one indicator, perhaps this indicator i found in the web is what you are looking for:

/*

*********************************************************************
          
                        Rainbow MMA 1
                   Copyright © 2006  Akuma99
                  http://www.beginnertrader.com
                  
*********************************************************************

*/


#property copyright "Code written by - Akuma99"

#property indicator_chart_window
#property indicator_buffers 8
#property indicator_color1 DeepSkyBlue
#property indicator_color2 DeepSkyBlue
#property indicator_color3 DeepSkyBlue
#property indicator_color4 Lime
#property indicator_color5 Lime
#property indicator_color6 Lime
#property indicator_color7 Lime
#property indicator_color8 Lime

//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];
double ExtMapBuffer4[];
double ExtMapBuffer5[];
double ExtMapBuffer6[];
double ExtMapBuffer7[];
double ExtMapBuffer8[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_LINE,EMPTY,1);
   SetIndexBuffer(0,ExtMapBuffer1);
   SetIndexStyle(1,DRAW_LINE,EMPTY,1);
   SetIndexBuffer(1,ExtMapBuffer2);
   SetIndexStyle(2,DRAW_LINE,EMPTY,1);
   SetIndexBuffer(2,ExtMapBuffer3);
   SetIndexStyle(3,DRAW_LINE,EMPTY,1);
   SetIndexBuffer(3,ExtMapBuffer4);
   SetIndexStyle(4,DRAW_LINE,EMPTY,1);
   SetIndexBuffer(4,ExtMapBuffer5);
   SetIndexStyle(5,DRAW_LINE,EMPTY,1);
   SetIndexBuffer(5,ExtMapBuffer6);
   SetIndexStyle(6,DRAW_LINE,EMPTY,1);
   SetIndexBuffer(6,ExtMapBuffer7);
   SetIndexStyle(7,DRAW_LINE,EMPTY,1);
   SetIndexBuffer(7,ExtMapBuffer8);
//----
   return(0);
  }

int deinit()
  {
   return(0);
  }

int start()
  {
   int i,j,limit,counted_bars=IndicatorCounted();
   
   
   if(counted_bars<0) return(-1);
   if(counted_bars>0) counted_bars--;
   limit=Bars-counted_bars;
   
   for(i=0; i<limit; i++){
      ExtMapBuffer1[i]=iMA(NULL,0,37,0,MODE_EMA,PRICE_CLOSE,i);
      ExtMapBuffer2[i]=iMA(NULL,0,39,0,MODE_EMA,PRICE_CLOSE,i);
      ExtMapBuffer3[i]=iMA(NULL,0,41,0,MODE_EMA,PRICE_CLOSE,i);
      ExtMapBuffer4[i]=iMA(NULL,0,44,0,MODE_EMA,PRICE_CLOSE,i);
      ExtMapBuffer5[i]=iMA(NULL,0,47,0,MODE_EMA,PRICE_CLOSE,i);
      ExtMapBuffer6[i]=iMA(NULL,0,50,0,MODE_EMA,PRICE_CLOSE,i);
   }
   

   return(0);
  }
//+------------------------------------------------------------------+
William Roeder
24188
William Roeder  
  1. ali_h3: I have no moving average in insert/indicators Tab...

    insert → indicators → trend.

  2. Don't resurrect old threads without a very good reason. A lot has changed since Build 600 and Higher. 2014.02.03