Download MetaTrader 5

MQL5 How to get zigzag values

To add comments, please log in or register
Roman Sharanov
396
Roman Sharanov  

Hi, I've tried a lot of code variations, but no matter what i shows me some random values.

Can anyone explain how to get these values?

#property copyright "Copyright 2018, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"
#property strict

int ZZ_handle;
double zz[];
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
//---
   ZZ_handle=iCustom(_Symbol,PERIOD_CURRENT,"ZigZag",4,0,0);
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//---
   
  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
//---
   CopyBuffer(ZZ_handle,0,0,20,zz);
   ArraySetAsSeries(zz,true);
   Comment("ZZ 4 ="+zz[1]);
  }
//+------------------------------------------------------------------+
nicholishen
1519
nicholishen  
RomanRott:

Hi, I've tried a lot of code variations, but no matter what i shows me some random values.

Can anyone explain how to get th

(zz[i] != 0.0 && zz[i] != EMPTY_VALUE)
Roman Sharanov
396
Roman Sharanov  
nicholishen:

and what to do with it?
I wrote this code but it still give nothing

void OnTick()
  {
//---
   CopyBuffer(ZZ_handle,0,0,20,zz);
   ArraySetAsSeries(zz,true);
   for(int i=0; i<20; i++)
      if(zz[i] != 0.0 && zz[i] != EMPTY_VALUE) Comment("ZZ 4 ="+zz[i]);
  }
To add comments, please log in or register