iMAonArray what is wrong

 

Hi guys,

i wrote this code in an indicator to show the value of the array and an moving average on this but the chart does only show the array not the MA.

What is wrong with that?

#property indicator_buffers 2       // Number of buffers
#property indicator_color1 Blue     // Color of the 1st line
#property indicator_color2 Red     // Color of the 1st line


double TrendBew[];
double SMAonTrend[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
   {
   string short_name="Trendrichtung";
   IndicatorBuffers(2);
   SetIndexStyle (0,DRAW_LINE,STYLE_SOLID,2);// Line style
   SetIndexBuffer(0,TrendBew);          // Assigning an array to a buffer
   SetIndexStyle (1,DRAW_LINE,STYLE_SOLID,2);// Line style
   SetIndexBuffer(1,SMAonTrend);          // Assigning an array to a buffer
   IndicatorShortName(short_name);  // Indicator name
   SetIndexLabel(0,short_name);     // Label im DataWindows
   }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
  int counted_bars=IndicatorCounted();
  int i;
  if(counted_bars<1)
      for(i=1;i<=Cross_Lame_Period;i++) TrendBew[Bars-i]=0.0;
  i=Bars-counted_bars-1;            // Index of the first uncounted
  while(i>=0)                      // Loop for uncounted bars
     {
     TrendBew[i]=0;
     if(TrendSMAHMA==true) TrendBew[i]= TrendBew[i] + fTrendbewertungSMAHMA(i);
      SMAonTrend[i]=iMAOnArray(TrendBew,Bars,5,0,MODE_SMA,i);
     
     i--;  // Calculating index of the next bar
     }
  }
 
FamWue:

Hi guys,

i wrote this code in an indicator to show the value of the array and an moving average on this but the chart does only show the array not the MA.

What is wrong with that?

We have already been through this once . . .  read your previous threads please.

https://www.mql5.com/en/forum/143479 

 
RaptorUK:

We have already been through this once . . .  read your previous threads please.

https://www.mql5.com/en/forum/143479 


Sorry for that.
Reason: