for whom concern in mql4 please help in coding

 

hi ii have this code but it start in tester then don't give me result just if i compile it again it will appear results

what is the correction of it please with all of my thanks

 

int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[])
  {
   int    i,limit;
//--- last counted bar will be recounted
   limit=rates_total-prev_calculated;
   if(prev_calculated>1){limit--;}
   for(i=0; i<limit-6; i++)
     {
      ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
      if(High[3+i]-Low[1+i]>Pips_Between_H_L*Point&&High[5+i]<High[4+i] &&High[4+i]<High[3+i] &&High[3+i]<High[2+i] && High[2+i]<High[1+i] && High[1+i]<High[0+i])
        {
        

        
         hup[i]=Open[i];

        }

      if(High[3+i]-Low[1+i]>Pips_Between_H_L*Point&&Low[5+i]>Low[4+i] &&Low[4+i]>Low[3+i] &&Low[3+i]>Low[2+i] && Low[2+i]>Low[1+i] && Low[1+i]>Low[0+i])
        {
       
         hdn[i]=Open[i];

        }

     }

//--- return value of prev_calculated for next call
   return(rates_total);
  }
//+-
 
abdallah alraie:

hi ii have this code but it start in tester then don't give me result just if i compile it again it will appear results

what is the correction of it please with all of my thanks

 

In my opinion the code is right. Could you attach indicator or send me and i'll check it.
 
Alexey Volchanskiy:
In my opinion the code is right. Could you attach indicator or send me and i'll check it.

hi thanks mr alexy for your reply this is my code i want to study last five candles but when indicator run on tester it stop when i put limit as normal it is continue working when i remove 6 of limit but it dosen't regive me results  as you run nothing after last signal you show when start testing... at all this is my code you can test it 

 

//+------------------------------------------------------------------+
//|                                                     Scalpsys.mq4 |
//|                           Copyright 2016, ShepherdSoftware Corp. |
//|  https://www.facebook.com/Forex-expert-advisor-261294777259940/? |
//+------------------------------------------------------------------+
#property copyright "Copyright 2016, ShepherdSoftware Corp."
#property link      "https://www.facebook.com/Forex-expert-advisor-261294777259940/?"
#property version   "1.01"

//#property icon        "\\Images\\SysReqMet.ico"; 
#property strict
#property indicator_chart_window
#property indicator_minimum    -5
#property indicator_maximum    5
#property indicator_buffers 2
#property indicator_plots   2
//--- plots
#property indicator_label1  "hdn"
#property indicator_type1   DRAW_ARROW
#property indicator_color1  clrDodgerBlue
#property indicator_style1  STYLE_SOLID
#property indicator_width1  2
#property indicator_label2  "hup"
#property indicator_type2   DRAW_ARROW
#property indicator_color2  clrRed
#property indicator_style2  STYLE_SOLID
#property indicator_width2  2

//--- input parameters
//input int      Take_Profit=4;
input int      Pips_Between_H_L=0;
bool     ALert=false;
bool     Send_Notification=false;

double bodyup;
//--- indicator buffers
double         hup[];
double         hdn[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {

   IndicatorShortName("h");
//--- indicator buffers mapping
   SetIndexEmptyValue(0,0);
   SetIndexEmptyValue(1,0);
   SetIndexBuffer(0,hup);
   SetIndexBuffer(1,hdn);
   SetIndexLabel(0,"hup");
   SetIndexLabel(1,"hdn");
   SetIndexArrow(0,108);
   SetIndexArrow(1,108);

//--- setting a code from the Wingdings charset as the property of PLOT_ARROW
   SetIndexStyle(1,DRAW_ARROW,STYLE_SOLID,1,clrDodgerBlue);
   SetIndexStyle(0,DRAW_ARROW,STYLE_SOLID,1,clrRed);
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
////////////////////////////////////////////////////////////////////////////////////////////////
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[])
  {
   int    i,limit;
//--- last counted bar will be recounted
   limit=rates_total-prev_calculated;
   if(prev_calculated>1){limit--;}
   for(i=0; i<limit-6; i++)
     {
      ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
      if(High[3+i]-Low[1+i]>Pips_Between_H_L*Point&&High[5+i]<High[4+i] &&High[4+i]<High[3+i] &&High[3+i]<High[2+i] && High[2+i]<High[1+i] && High[1+i]<High[0+i])
        {
        

        
         hup[i]=Open[i];

        }

      if(High[3+i]-Low[1+i]>Pips_Between_H_L*Point&&Low[5+i]>Low[4+i] &&Low[4+i]>Low[3+i] &&Low[3+i]>Low[2+i] && Low[2+i]>Low[1+i] && Low[1+i]>Low[0+i])
        {
       
         hdn[i]=Open[i];

        }

     }

//--- return value of prev_calculated for next call
   return(rates_total);
  }
//+------------------------------------------------------------------+
 

Hi man,

it work this way, try it  :

int start()
   {
   int    i,limit;
//--- last 
    i = Bars - 100;
     int counted_bars = IndicatorCounted();// will be recounted
   if( counted_bars > 100) i=  Bars - counted_bars-1;
    while(i>=0) 
         {
      ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
      if(  High[3+i]-Low[1+i]>Pips_Between_H_L*Point && 
           High[5+i]<High[4+i] && High[4+i]<High[3+i] && 
           High[3+i]<High[2+i] && High[2+i]<High[1+i] && High[1+i]<High[i])
        {
         hup[i]=Open[i];
        }

      if( High[3+i]-Low[1+i]>Pips_Between_H_L*Point && 
          Low[5+i]>Low[4+i] &&Low[4+i]>Low[3+i] && 
           Low[3+i]>Low[2+i] && Low[2+i]>Low[1+i] && Low[1+i]>Low[0+i])
        {
         hdn[i]=Open[i];
        }
 i--;
 }
//--- return value of prev_calculated for next call
   return(0);
  }
//+------------------------------------------------------------------+
 
ffoorr:

Hi man,

it work this way, try it  :

thanks for help i will try it thanks again
 
ffoorr:

Hi man,

it work this way, try it  :

woooooooooow it is working you proffessional thank you so much man thank you thank you
Reason: