Download MetaTrader 5
To add comments, please log in or register
Deposit to your account via WebMoney
jayaramnaick bukke
555
jayaramnaick bukke 2016.11.21 07:53 

Hi 

Below is simple indicator.

can some one correct me undelcared identifier of <i>,< LowerWick >& <UpperWick>.

I have no idea how to correct it.

Thanks

//+------------------------------------------------------------------+
//|                                      Jaya Fractals(all)(4x4).mq4 |
//|                                                          Jayaram |
//|                                                                  |
//+------------------------------------------------------------------+
#property copyright "Jayaram"
#property link      ""

#property indicator_chart_window

// The number of buffers for calculation, up to 8
#property indicator_buffers 2

// The color for displaying arrows
#property indicator_color1 Blue         // Long signal
#property indicator_color2 Red         // Short signal

// Width of the arrows
#property indicator_width1 3  // Long signal arrow
#property indicator_width2 3  // Short signal arrow
extern int ArrowDistance = 5;
// Buffers for the calculations
double Up_Arrow_Buffer[];    // Long buffer for display
double Down_Arrow_Buffer[];   // Short buffer for display
// copyied below by you from net
//double upper   = High[i] - MathMax( Open[i], Close[i]),
//      bottom  = MathMin( Open[i], Close[i] )-Low[i] ;
// copyied above from net
int RightSideCandleNum = 2; // define inpupt integer minimum to start from i.e= 2 (i-1, i-2 after i)
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
//copyied below by you from net
int init()
{

//double BarLength=Mathabs(High[i]-Low[i]),
//       BarBody=mathabs(Close[i]-Open[i]),
double UpperWick, LowerWick;
if (Close[i]>Open[i])
{
UpperWick=High[i]-Close[i];
LowerWick=Open[i]-Low[i];
}else
{
UpperWick=High[i]-Open[i];
LowerWick=Close[i]-Low[i];
}
//Alert("Length of bar:",BarLength,"Length of body:",BarBody,"Length of upperwick:"
//,UpperWick,"Length of lower wick:",LowerWick);
//}

//copied above by you from net
//int init()
//{
   // SetIndexStyle  - sets the new type, style, width and color for a given indicator line
   // SetIndexBuffer - binds the array variable declared at a global level to the custom indicator pre-defined buffer
   // SetIndexArrow  - sets an arrow symbol for indicators line of the DRAW_ARROW type.
   SetIndexStyle(0, DRAW_ARROW);
   SetIndexBuffer(0, Up_Arrow_Buffer);
   SetIndexArrow(0, 159); // Up arrow
   SetIndexStyle(1, DRAW_ARROW);
   SetIndexBuffer(1, Down_Arrow_Buffer);
   SetIndexArrow(1, 159); // Down arrow
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
  
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
{
   int i;                           // Bar index      
   int Counted_bars;                // Number of counted bars
   //--------------------------------------------------------------------  
   Counted_bars=IndicatorCounted(); // Number of counted bars  
   i=Bars-Counted_bars-1;           // Index of the first uncounted which is zero bar(current bar)

   if (i == 0)
   {
      i = 3;  // the newest signal bar maximum limit is till at index 3 (i-2,i-1 & i)(and min stats with index 3 as we mentioned while(i>2)
   }
   while(i>2)                      // Loop for uncounted bars but always recount the newest 3 bars
   {      
      if (isUpSwingBar(i))
      {
         if (RightSideCandleNum == 2 || (RightSideCandleNum == 2 && i >2)) // mention condition if number of completed bars to the rightside of swingupbar(i)
         {
            Up_Arrow_Buffer[i] = Low[i] - (ArrowDistance * Point);
            
         }
      }
      else if (isDownSwingBar(i))
      {
         if (RightSideCandleNum == 2 || (RightSideCandleNum == 2 && i >2)) // mention condition if number of completed bars to the rightside of swingdownbar(i)
         {
            Down_Arrow_Buffer[i] = High[i] + (ArrowDistance * Point);
          
         }
      }
      
      i--;
   }
//----
   return(0);
}

bool isUpSwingBar(int i)
{
   if (UpSwingLeftOk(i))
   {
      return (true);
   }
   return (false);
}

bool UpSwingLeftOk(int i)                          //Support LEFT OF i bar
{
   if (Low[i]<Low[i+1] && Low[i]<Low[i+2] && Low[i]<Low[i-1] && Low[i]<Low[i-2] &&  LowerWick [i]> LowerWick[i+1] && LowerWick[i]>  LowerWick[i+2] &&  LowerWick[i]> LowerWick[i-1] &&  LowerWick[i]> LowerWick[i-2])   // buy support
   {
   return (true);
   }
   return (false);
}

bool isDownSwingBar(int i)
{
   if (DownSwingLeftOk(i))
   {
      return (true);
   }
   return (false);
}

bool DownSwingLeftOk(int i)                           //Resistance LEFT OF i bar
{
  if (High[i]>High[i+1] && High[i]>High[i+2] && High[i]>High[i-1] && High[i]>High[i-2] && UpperWick[i]> UpperWick[i+1] && UpperWick[i]>UpperWick[i+2] && UpperWick[i]>UpperWick[i-1] && UpperWick[i]>UpperWick[i-2])   // sell resistance
   {
   return (true);
   }
   return (false);
}
  
//+------------------------------------------------------------------+

while compiling errors i am getting is


 

Carl Schreiber
5939
Carl Schreiber 2016.11.21 08:22  
In init() i isn't declared, and the array LowerWick[] & UpperWick[] aren't declared anywhere!
In init() you use variables with this name but not arrays!
jayaramnaick bukke
555
jayaramnaick bukke 2016.11.21 10:10  
Carl Schreiber:
In init() i isn't declared, and the array LowerWick[] & UpperWick[] aren't declared anywhere!
In init() you use variables with this name but not arrays!
can u write down it in code please..
/
To add comments, please log in or register