Beginner Question: Using Alligator Indicator in EA

 

Hi,

I would like to build an EA using the Alligator indicator which consists of three moving averages. Therefore, I tried to copy the values of these moving averages into an array, as I've done before with the CCI indicator.

However, I get the error message: "Jaws" - parameter conversion not allowed.

So first I initialize the three arrays and the Alligator handle:

double      Jaws[],Teeth[],Lips[]; 
int Alligator_handle ;  

In the OnInit handle I create the indicator Alligator:


     Alligator_handle=iAlligator(NULL,0,13,8,8,5,5,3,MODE_EMA,PRICE_MEDIAN);

Then, within the OnTick handle I do the following to copy the indicator values to the three arrays:

if(!CopyBufferAsSeries(Alligator_handle,0,100,Jaws,Teeth,Lips,true)) Print ("Buffering of Alligator to array failed");

Can maybe someone tell what I am doing wrong? Thanks!

Alligator
Alligator
  • votes: 14
  • 2010.01.26
  • MetaQuotes Software Corp.
  • www.mql5.com
The Alligator Indicator is a combination of Balance Lines (Moving Averages).
 
pipmaniac:

Hi,

I would like to build an EA using the Alligator indicator which consists of three moving averages. Therefore, I tried to copy the values of these moving averages into an array, as I've done before with the CCI indicator.

However, I get the error message: "Jaws" - parameter conversion not allowed.

So first I initialize the three arrays and the Alligator handle:

In the OnInit handle I create the indicator Alligator:


Then, within the OnTick handle I do the following to copy the indicator values to the three arrays:

Can maybe someone tell what I am doing wrong? Thanks!

Which line gives you the error ?

What is the code of your CopyBufferAsSeries function ?

 
angevoyageur:

Which line gives you the error ?

What is the code of your CopyBufferAsSeries function ?

The error appears for the in which I call the function CopyBufferAsSeries.

And this is the CopyBufferAsSeries function:

bool CopyBufferAsSeries(
                        int handle,      // handle
                        int bufer,       // buffer number
                        int start,       // start from
                        int number,      // number of elements to copy
                        bool asSeries,   // is as series
                        double &M[]      // target array for data
                        )
  {
//--- filling M with current values of the indicator
   if(CopyBuffer(handle,bufer,start,number,M)<=0) return(false);

   ArraySetAsSeries(M,asSeries);

   return(true);


I think the problem here is that the CopyBufferAsSeries function works only for single buffer indicators like a simple moving average.

This means that I need to extend the function by further buffers, right?

Documentation on MQL5: Timeseries and Indicators Access / CopyBuffer
Documentation on MQL5: Timeseries and Indicators Access / CopyBuffer
  • www.mql5.com
Timeseries and Indicators Access / CopyBuffer - Documentation on MQL5
 
pipmaniac:

The error appears for the in which I call the function CopyBufferAsSeries.

And this is the CopyBufferAsSeries function:


I think the problem here is that the CopyBufferAsSeries function works only for single buffer indicators like a simple moving average.

This means that I need to extend the function by further buffers, right?

Of course, and you can't call a function defined with 6 parameters using 7.