Please help me to fix this code

 

Hi,

I want to get High & Low,like London Breakout  strategy. But when MT4 up to Build 600, my code can't run.

How can I fix it, Please help me, thx

int startN1,endN1,i;
extern int startN=7,endN=8; 
       i=1;
      while(TimeHour(iTime(0,0,i))>endN) i++;
      endN1=i;
      if(startN==0) while(TimeDay(iTime(0,0,i))==TimeDay(TimeCurrent())){i++;}
      if(startN!=0) while(TimeHour(iTime(0,0,i))>=startN){i++;}
      startN1=i;
      highN=High[iHighest(NULL,0,MODE_HIGH,startN1-endN1,endN1)];
      lowN=Low[iLowest(NULL,0,MODE_LOW,startN1-endN1,endN1)]; 
 
jojocash:


Hello,

Please use the SRC button when you post code. Thank you.


This time, I edited it for you.


The script works, just do not understand what it does :)

//+------------------------------------------------------------------+
//|                                                  test_script.mq4 |
//|                        Copyright 2015, MetaQuotes Software Corp. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2015, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"
#property strict
#property script_show_inputs
int startN1,endN1,i;
extern int startN=7,endN=8;
//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart()
  {
//---
   i=1;
   while(TimeHour(iTime(NULL,0,i))>endN)
      i++;
   endN1=i;
   if(startN==0)
      while(TimeDay(iTime(NULL,0,i))==TimeDay(TimeCurrent()))
        {
         i++;
        }
   if(startN!=0)
      while(TimeHour(iTime(NULL,0,i))>=startN)
        {
         i++;
        }
   startN1=i;
   double highN=High[iHighest(NULL,0,MODE_HIGH,startN1-endN1,endN1)];
   double lowN=Low[iLowest(NULL,0,MODE_LOW,startN1-endN1,endN1)];
   Print("high=",DoubleToString(highN),", low=",DoubleToString(lowN));
  }
//+------------------------------------------------------------------+

 

test 

 
barabashkakvn:


The script works, just do not understand what it does :)

 

 

Thank you , But I want to create a indicator like this photo ( NZDUSD ). If I used 7,8 ,the mean is time 7 & 8's  Highest and Lowest.

Can you teach me how can I do it. THX

 

 
jojocash :

Thank you , But I want to create a indicator like this photo ( NZDUSD ). If I used 7,8 ,the mean is time 7 & 8's  Highest and Lowest.

Can you teach me how can I do it. THX

Teach? All right. Then the task №1: in the MetaEditor create a custom indicator.