Download MetaTrader 5
To add comments, please log in or register
Sell your applications via the Market. It is secure!
Rock-Trader.com
197
Rohit Sharma 2014.06.06 15:56 

Dear Traders ,


Please help me to call this indicator in to an Other Custom indicator I create, some problems I face now,

iCustom(Symbol(),0,"FractalZigZagNoRepaint",ZZDepth,ZZDev,0,i) '0' Buffer For BUY
iCustom(Symbol(),0,"FractalZigZagNoRepaint",ZZDepth,ZZDev,1,i) '1' Buffer For SELL

I have Added the Indicator Code Here, Please Help me to Find Which Parameter I missed

//+------------------------------------------------------------------+
//|                                       FractalZigZagNoRepaint.mq4 |
//|                        Copyright 2014, MetaQuotes Software Corp. |
//|                                              https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2014, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"
#property strict
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Blue
#property indicator_color2 Red

#define IName          "Fractal ZigZag No-Repaint"
#define ZZBack         1

//-------------------------------
// Input parameters
//-------------------------------
extern bool CalculateOnBarClose    = true;
extern int  ZZDepth                = 12;
extern int  ZZDev                  = 5;


//-------------------------------
// Buffers
//-------------------------------
double ExtMapBuffer1[];
double ExtMapBuffer2[];

//-------------------------------
// Internal variables
//-------------------------------

// Fractals value -mine-
double fr_resistance       = 0;
double fr_support          = EMPTY_VALUE;
bool fr_resistance_change  = EMPTY_VALUE;
bool fr_support_change     = EMPTY_VALUE;

// zzvalues
double zzhigh = 0;
double zzlow = 0;

// Offset in chart
int    nShift;   

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
{
    // Arrows
    SetIndexStyle(0, DRAW_ARROW, STYLE_DOT, 1);
    SetIndexArrow(0, 233);
    SetIndexBuffer(0, ExtMapBuffer1);
    SetIndexStyle(1, DRAW_ARROW, STYLE_DOT, 1);
    SetIndexArrow(1, 234);
    SetIndexBuffer(1, ExtMapBuffer2);
   
  
    // Data window
    IndicatorShortName("Fractal Zig Zag No Repaint");
    SetIndexLabel(0, "Fractal Up");
    SetIndexLabel(1, "Fractal Down"); 
    
    // Copyright
    Comment("Copyright © http://www.pointzero-indicator.com");
   
    // Chart offset calculation
    switch(Period())
    {
        case     1: nShift = 1;   break;    
        case     5: nShift = 3;   break; 
        case    15: nShift = 5;   break; 
        case    30: nShift = 10;  break; 
        case    60: nShift = 15;  break; 
        case   240: nShift = 20;  break; 
        case  1440: nShift = 80;  break; 
        case 10080: nShift = 100; break; 
        case 43200: nShift = 200; break;               
    }
    nShift = nShift * 2;
    return(0);
}

//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
    return(0);
  }
  
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
    // Start, limit, etc..
    int start = 0;
    int limit;
    int counted_bars = IndicatorCounted();

    // nothing else to do?
    if(counted_bars < 0) 
        return(-1);

    // do not check repeated bars
    limit = Bars - 1 - counted_bars;
    
    // Check if ignore bar 0
    if(CalculateOnBarClose == true) start = 1;
    
    // Check the signal foreach bar from past to present
    for(int i = limit; i >= start; i--)
    {
        // Zig Zag high
        double zzhighn = iCustom(Symbol(), 0, "ZigZag", ZZDepth, ZZDev, ZZBack, 1, i);
        if(zzhighn != 0) zzhigh = zzhighn;
        
        // Zig Zag low
        double zzlown  = iCustom(Symbol(), 0, "ZigZag", ZZDepth, ZZDev, ZZBack, 2, i);
        if(zzlown != 0) zzlow = zzlown;
     
        // Last fractals
        double resistance = upper_fractal(i);
        double support = lower_fractal(i);
        
        //--------------------------------------------------------
        // Show signals
        //--------------------------------------------------------
        
        // Show signal if it is a fractal and matches last zigzag high value
        if(fr_support_change == true && fr_support == zzlow)
        {
            // Show arrow on fractal and pricetag
            ExtMapBuffer1[i+2] = fr_support - nShift*Point;
            
        } else 
       
        // Show signal if it is a fractal and matches last zigzag low value
        if(fr_resistance_change == true && fr_resistance == zzhigh)
        {
            // Show arrow on fractal and pricetag
            ExtMapBuffer2[i+2] = fr_resistance + nShift*Point;
        }
    }
    return(0);
}

//+------------------------------------------------------------------+
//| Custom code ahead
//+------------------------------------------------------------------+

/**
* Returns fractal resistance
* @param int shift
*/

double upper_fractal(int shift = 1)
{
   double middle = iHigh(Symbol(), 0, shift + 2);
   double v1 = iHigh(Symbol(), 0, shift);
   double v2 = iHigh(Symbol(), 0, shift+1);
   double v3 = iHigh(Symbol(), 0, shift + 3);
   double v4 = iHigh(Symbol(), 0, shift + 4);
   if(middle > v1 && middle > v2 && middle > v3 && middle > v4/* && v2 > v1 && v3 > v4*/)
   {
      fr_resistance = middle;
      fr_resistance_change = true;
   } else {
      fr_resistance_change = false;
   }
   return(fr_resistance);
}

/**
* Returns fractal support and stores wether it has changed or not
* @param int shift
*/

double lower_fractal(int shift = 1)
{
   double middle = iLow(Symbol(), 0, shift + 2);
   double v1 = iLow(Symbol(), 0, shift);
   double v2 = iLow(Symbol(), 0, shift+1);
   double v3 = iLow(Symbol(), 0, shift + 3);
   double v4 = iLow(Symbol(), 0, shift + 4);
   if(middle < v1 && middle < v2 && middle < v3 && middle < v4/* && v2 < v1 && v3 < v4*/)
   {
      fr_support = middle;
      fr_support_change = true;
   } else {
      fr_support_change = false;
   }
   return(fr_support);
}

//+------------------------------------------------------------------+
whroeder1
13627
whroeder1 2014.06.06 18:14  
Rock-Trader: Please Help me to Find Whic
Detailed explanation of iCustom - MQL4 forum
iCustom(Symbol(),0,"FractalZigZagNoRepaint",ZZDepth,ZZDev,0,i) '0' Buffer For BUY
iCustom(Symbol(),0,"FractalZigZagNoRepaint",ZZDepth,ZZDev,1,i) '1' Buffer For SELL
                                               2      3  


extern bool CalculateOnBarClose    = true; //1
extern int  ZZDepth                = 12;   //2
extern int  ZZDev                  = 5;    //3
Rock-Trader.com
197
Rohit Sharma 2014.06.07 02:37  
WHRoeder:
Rock-Trader: Please Help me to Find Whic
Detailed explanation of iCustom - MQL4 forum




Is this the Right way ?

iCustom(Symbol(),0,"FractalZigZagNoRepaint",2,3,0,i) '0' Buffer For BUY
iCustom(Symbol(),0,"FractalZigZagNoRepaint",2,3,1,i) '1' Buffer For SELL
whroeder1
13627
whroeder1 2014.06.07 16:44  
Rock-Trader: Is this the Right way ?
iCustom(Symbol(),0,"FractalZigZagNoRepaint",2,3,0,i) '0' Buffer For BUY
iCustom(Symbol(),0,"FractalZigZagNoRepaint",2,3,1,i) '1' Buffer For SELL
Previously asked and answered. The indicator has three parameters. You are passing two.
/
To add comments, please log in or register