adaptive moving average in Expert

 

Hello,

 

i want to use Adaptive Moving Average and in have no idea how to use the buffer,

i test it in the same way as i use the normal EMA

 

input int AMA_Periode = 9;
input int AMA_Schnell = 2;
input int AMA_Langsam = 30;
input int AMA_Shift = 0;

double AMA[];   // Stundenbasis
int   AMAHandle=0;// Stundenbasis
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+



//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int OnInit()
  {


   AMAHandle   = iAMA(_Symbol,PERIOD_D1,AMA_Periode,AMA_Langsam,AMA_Schnell,AMA_Shift,PRICE_OPEN);


// in welcher Häufigkeit (Sekunden) das Event vorkommen soll
   EventSetTimer(60);

   return(0);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {//--- destroy timer
   EventKillTimer();
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void OnTimer()
  {
//---

   double Ask = SymbolInfoDouble(_Symbol,SYMBOL_ASK);
   double Bid = SymbolInfoDouble(_Symbol,SYMBOL_BID);


      CopyBuffer(AMA,0,0,100,AMA);
      ArraySetAsSeries(AMA,true);

 

and this pretty code get me an Error,

i'm absoluty sure, that there is the Error with  

 

 CopyBuffer(AMA,0,0,100,AMA);

 

 

and idea?

 

thanks for help

 

amando 

 

amando:

i'm absoluty sure, that there is the Error with  

 

 CopyBuffer(AMA,0,0,100,AMA);

 

Of course, CopyBuffer needs an handle as first parameter. Your handle is AMAHandle not AMA.

Check the returned value and print the error code, it should help you to debug your code.