Hi all,
I am coding me new breakout system and I have little problem with it.
I need two lines, one for low, one for high. I want to take this high, low from 5M chart between 9 and 10 hour.
Can you help me? Thank u soo much
If your EA is not on the M5 chart then you will need to use iHigh() and iLow() to get the high and low of the highest and lowest bars between 9 and 10 am . . . to get the Highest and Lowest bars use iHighest() and iLowest()
You haven't said what exatly you are having problems with ? drawing the lines ? calculating the High and Low, working out when 9am and 10am are ?
I propose you following code to define your line parameters :
string Start= "09:00"; //start time string End= "10:00"; //End Time datetime Time_S,Time_E; datetime Now=TimeCurrent();//Server Time int bar1,bar2; double HighPrice,LowPrice; Time_S= StrToTime(TimeToStr(Now, TIME_DATE)+" "+Start); Time_E= StrToTime(TimeToStr(Now, TIME_DATE)+" "+End); bar1=iBarShift(Symbol(),TF,Time_S); bar2=iBarShift(Symbol(),TF,Time_E); HighPrice=iHighest(Symbol(),0,MODE_HIGH,bar1-bar2,bar2); // the Highest of 09:00 to 10:00 LowPrice=iLowest(Symbol(),0,MODE_LOW,bar1-bar2,bar2); // the Lowest of 09:00 to 10:00
This code will give you the High price and Low price in the 09:00-10:00 interval
Hope it can help you :)
Kane.
If your EA is not on the M5 chart then you will need to use iHigh() and iLow() to get the high and low of the highest and lowest bars between 9 and 10 am . . . to get the Highest and Lowest bars use iHighest() and iLowest()
You haven't said what exatly you are having problems with ? drawing the lines ? calculating the High and Low, working out when 9am and 10am are ?
Thank u for reply. My problem is how to calculate high and low. My EA will run on the 5M chart, and i do not know how to extract high and low from only one hour. Or a should use iHighest /iLowest from H1 chart. Is it easyer?
bar1=iBarShift(Symbol(),TF,Time_S);is the TimeFrame Value.
Thank u for reply. My problem is how to calculate high and low. My EA will run on the 5M chart, and i do not know how to extract high and low from only one hour. Or a should use iHighest /iLowest from H1 chart. Is it easyer?
Yes you can do like that to:
double High, Low High= iHigh(Symbol(),PERIOD_H1,1) Low= iLow(Symbol(),PERIOD_H1,1
So you have the high and Low of the lasr Candle. You have finally to write
if (time== X)
Allow to Trade of Draw object.
I propose you following code to define your line parameters :
This code will give you the High price and Low price in the 09:00-10:00 interval
Hope it can help you :)
Kane.
I propose you following code to define your line parameters :
string Start= "09:00"; //start time datetime Time_S,Time_E; datetime Now=TimeCurrent();//Server Time Time_S= StrToTime(TimeToStr(Now, TIME_DATE)+" "+Start);
#define HR2400 86400 // 24 * 3600 datetime TimeOfDay(datetime when){ return( when % HR2400 ); } datetime DateOfDay(datetime when){ return( when - TimeOfDay(when) ); } : #define HR0900 32400 datetime Now=TimeCurrent();//Server Time datetime Time_S = DateOfDay(Now)+HR0900;
Also needed is to handle the case where Now is before 9:00
if (Now < Time_S){ #define DOW_SUNDAY 0 Time_S = iTime(NULL, PERIOD_D1, 1)+ HR0900; if (TimeDayOfWeek(Time_S) == DOW_SUNDAY) // Market opens 2200 Sunday Time_S = iTime(NULL, PERIOD_D1, 2)+ HR0900; // Use Friday }
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi all,
I am coding me new breakout system and I have little problem with it.
I need two lines, one for low, one for high. I want to take this high, low from 5M chart between 9 and 10 hour.
Can you help me? Thank u soo much
LukasFX