Can you help me please for the principle of mirror indicator : here Moving average

 

I see here some indicators like Macd mirror or RSI mirror but I don't understand the way (code) that we can appear the opposite of indicator : for example basing in the MA_Mirror (indicator that I saw here ) :

#property  indicator_separate_window
#property indicator_level1 1
#property indicator_levelcolor White
#property  indicator_buffers 2
#property  indicator_color1  Red
#property  indicator_color2  Blue
#property  indicator_width1 2
#property  indicator_width2 2
 
extern double MovingPeriod       = 20;
extern double MovingShift        = 0;
double     MacdBuffer1[];
double     MacdBuffer2[];
double     ma1,ma2;
 
 
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- drawing settings
   SetIndexStyle(0,DRAW_LINE);
   SetIndexStyle(1,DRAW_LINE);
 
   
   IndicatorDigits(Digits+1);
//---- indicator buffers mapping
   SetIndexBuffer(0,MacdBuffer1);
   SetIndexBuffer(1,MacdBuffer2);
 
   
 
   IndicatorShortName("MA_Mirror by Andy Tjatur");
   SetIndexLabel(0,"MA_CO");
   SetIndexLabel(1,"MA_OC");
 
   
 
   return(0);
  }
//+------------------------------------------------------------------+
//| Moving Averages Mirror                                           |
//+------------------------------------------------------------------+
int start()
  {
   int limit;
   int counted_bars=IndicatorCounted();
 
   if(counted_bars>0) counted_bars--;
   limit=Bars-counted_bars;
 
  
   for(int i=0; i<limit; i++)
      MacdBuffer1[i]=iMA(NULL,0,MovingPeriod,MovingShift,MODE_SMA,PRICE_CLOSE,i)-iMA(NULL,0,MovingPeriod,MovingShift,MODE_SMA,PRICE_OPEN,i);
    
   for(i=0; i<limit; i++)
      MacdBuffer2[i]=iMA(NULL,0,MovingPeriod,MovingShift,MODE_SMA,PRICE_OPEN,i)-iMA(NULL,0,MovingPeriod,MovingShift,MODE_SMA,PRICE_CLOSE,i);
    
 
 
   return(0);
  }
//+------------------------------------------------------------------+

my intention is to show an indicator basing in moving average and in the same way it shows it's opposite (mirror ) here 's the code :

//+------------------------------------------------------------------+
//|                                               histogramtrend.mq4 |
//|                      Copyright © 2011, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net 
  //|
//+------------------------------------------------------------------+
#property copyright "Copyright © 2011, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"
// represnete un histogramme des croisements

#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 Black
#property indicator_color2 Blue
//--- input parameters
extern int       period1=30;
extern int       period2=7;
//--- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];


//

double ExtMapBuffer3[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
    IndicatorBuffers(3);
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0,ExtMapBuffer1);
   
   SetIndexStyle(1,DRAW_LINE);
   SetIndexBuffer(1,ExtMapBuffer3);
   
    SetIndexBuffer(2,ExtMapBuffer2);
     
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   
   int    counted_bars=IndicatorCounted();
   int limit ;
   
//----
         if(counted_bars>0) counted_bars--;
                limit = Bars-counted_bars;
                        
                                for(int i=0;i<limit;i++)
                                {
                                  ExtMapBuffer2[i] = iMA(NULL,0,period1,0,MODE_LWMA,PRICE_CLOSE,i);
                                }
                                
                                        for(i=0;i<limit;i++)
                                {
                                        ExtMapBuffer3[i] = iMAOnArray(ExtMapBuffer2,0,period2,0,MODE_EMA,i);
                                }
                                
                        
                                
                                for(i=0;i<limit;i++)
                                {
                                
                                   // ligne 
                                    ExtMapBuffer1[i] = 0 ; 
                                   
                                
                                }
   
//----
   return(0);
  }
//+------------------------------------------------------------------+

here we must show  ExtMapBuffer1 = 0 and  ExtMapBuffer3 

of course we need an other buffer for the opposite !! please can you help me to make the mirror of this code ??

or to explian me according the MA mirror 's code what's the word key which permit to show the mirror ???

because when I compare the code (MA mirror )

 for(int i=0; i<limit; i++)
      MacdBuffer1[i]=iMA(NULL,0,MovingPeriod,MovingShift,MODE_SMA,PRICE_CLOSE,i)-iMA(NULL,0,MovingPeriod,MovingShift,MODE_SMA,PRICE_OPEN,i);
    
   for(i=0; i<limit; i++)
      MacdBuffer2[i]=iMA(NULL,0,MovingPeriod,MovingShift,MODE_SMA,PRICE_OPEN,i)-iMA(NULL,0,MovingPeriod,MovingShift,MODE_SMA,PRICE_CLOSE,i);

MacdBuffer1[i] and MacdBuffer2[i] are almost the same !! and so wht is the difference between IndicatorDigits(Digits+1); and IndicatorBuffers(3);

thanks

Reason: