Pass Values from ZigZag Indicator to an EA

 

Hi everyone,


Excuse my questions but I am new to the MQL languages.

I am trying to make an EA that will use the highs and lows of the ZigZag indicator(attached).

My questions:

1)How can I include this indi to my EA?

2)How can I store the values of highs and lows from ZigZag to an array?


Thanks,


Stergio

Files:
zigzag.mq5  10 kb
 
1332120 :


Example of various advisors that use ZigZag

 
Vladimir Karputov:

Example of various advisors that use ZigZag

Hi Vladimir,

Thanks for the reply!

Although the link was in Russian I did manage to find the iCustom() function which is probably what I must use.

Now, that I have the handle of ZigZag how do I use CopyBuffer() to store the values to an array?

This is the code I am using but it is not working

   //--- Create ZigZag array
   double ZigZag[];
   
   //--- Define indi
   int ZigZagHandle = iCustom(_Symbol,_Period,"Examples\\ZigZag",12,5,3);
   
    //---Copy values to array  
   CopyBuffer(ZigZagHandle,0,0,10,ZigZag);

Again excuse my stupid question but I have spend hours on that simple thing and I am desperate!

Thanks,

Stergio

 
Stergio :

Hi Vladimir,

Thanks for the reply!

Although the link was in Russian I did manage to find the iCustom() function which is probably what I must use.

Now, that I have the handle of ZigZag how do I use CopyBuffer() to store the values to an array?

This is the code I am using but it is not working

Again excuse my stupid question but I have spend hours on that simple thing and I am desperate!

Thanks,

Stergio

You make the same grossest mistake: you do not read the documentation and do not want to learn! ICustom Help.

Please note - the handle is created ONCE! ONCE IN OnInit ()!

Documentation on MQL5: Technical Indicators / iCustom
Documentation on MQL5: Technical Indicators / iCustom
  • www.mql5.com
[in]  The name of the custom indicator, with path relative to the root directory of indicators (MQL5/Indicators/). If an indicator is located in a subdirectory, for example, in MQL5/Indicators/ [in] input-parameters of a custom indicator, separated by commas. Type and order of parameters must match. If there is no parameters specified, then...
 
Example: 
How to start with MQL5
How to start with MQL5
  • 2018.12.24
  • www.mql5.com
This thread discusses MQL5 code examples. There will be examples of how to get data from indicators, how to program advisors...
 
Vladimir Karputov:

Thank you Vladimir!

I really appreciate your help!

Reason: