anthor:
2)how to check is the trade date is today date?? using the OrderOpenTime()
Question
i m using 1H chart,and i would like to
2)how to check is the trade date is today date?? using the OrderOpenTime()
1.
double HighestFrom0to5am = iHigh(NULL, PERIOD_H1, iHighest(NULL, PERIOD_H1, MODE_HIGH, 5, TimeHour(TimeCurrent()) - 5) );
from this you should get the idea of how to do the lowest . . .
Note: not tested . . . please test properly.
2.
OrderSelect(. . . . ); if(TimeDayOfYear(OrderOpenTime()) == TimeDayOfYear(TimeCurrent())) Print("Order was placed today ! ");
this works unless your order is exactly a year or 2 years or 3 years, etc, old.
double HighestFrom0to5am = iHigh(NULL, PERIOD_H1, iHighest(NULL, PERIOD_H1, MODE_HIGH, 5, TimeHour(TimeCurrent()) - 5) );why don't just use the IHighest ?? why need IHigh???i don't know what is the different
anthor:
why don't just use the IHighest ?? why need IHigh???i don't know what is the different
Look at the Documentation, what does iHighest() return ?
why don't just use the IHighest ?? why need IHigh???i don't know what is the different
RaptorUK:
Look at the Documentation, what does iHighest() return ?
Look at the Documentation, what does iHighest() return ?
i don't understand the different iHigh and iHighest explanation from documentation,
if not i won't ask.thanks you very much
anthor:
i don't understand the different iHigh and iHighest explanation from documentation,
if not i won't ask.thanks you very much
From the iHighest() documentation . . . "Returns the shift of the maximum value over a specific number of periods depending on type." it returns the shift ( bar number ), not a price . . you want the price, so you need to use iHigh (or High[] ) to get the high of the bar number returned by iHighest.
i don't understand the different iHigh and iHighest explanation from documentation,
if not i won't ask.thanks you very much
anthor:
1)get today Bar Highest and lowest Price from 12:00AM to 5:00A.M
2)how to check is the trade date is today date?? using the OrderOpenTime()
1)get today Bar Highest and lowest Price from 12:00AM to 5:00A.M
2)how to check is the trade date is today date?? using the OrderOpenTime()
The above codes makes use of the fact that you are on the H1 chart. Below works on any TF <= D1
not compiled, not tested
#define HR2400 86400 // 24 * 3600 datetime TimeOfDay(datetime when){ return( when % HR2400 ); } datetime DateOfDay(datetime when){ return( when - TimeOfDay(when) ); } ////// #define HR0500 18000 datetime OOT = OrderOpenTime(), now = TimeCurrent(), bod = DateOfDay(now), hr5 = bod + HR0500; if (hr5 > now) .. // before 5AM. Next day? need to handle? int iBod = iBarShift(NULL, 0, bod), iHR5 = iBarShift(NULL, 0, hr5), iHH = iHighest(NULL,0, MODE_HIGH, iBod - iHR5, iHR5+1); // Not including 5AM double HH5 = High[iHH]; bool isTodaysTrade = DateOfDay(OOT) == bod;
not compiled, not tested
datetime OOT = OrderOpenTime() bool isTodaysTrade = DateOfDay(OOT) == bod;i don't understand here
bool isTodaysTrade = DateOfDay(OOT) == bod;
can explain please?
RaptorUK:
From the iHighest() documentation . . . "Returns the shift of the maximum value over a specific number of periods depending on type." it returns the shift ( bar number ), not a price . . you want the price, so you need to use iHigh (or High[] ) to get the high of the bar number returned by iHighest.
From the iHighest() documentation . . . "Returns the shift of the maximum value over a specific number of periods depending on type." it returns the shift ( bar number ), not a price . . you want the price, so you need to use iHigh (or High[] ) to get the high of the bar number returned by iHighest.
oh....! thanks!
#define HR2400 86400 // 24 * 3600 datetime TimeOfDay(datetime when){ return( when % HR2400 ); } datetime DateOfDay(datetime when){ return( when - TimeOfDay(when) ); } #define HR0500 18000 #define HR1200 43200 int start() { //---- datetime now = TimeCurrent(), bod = DateOfDay(now)+ HR0500, hr5 = bod + HR1200; if (hr5 > now) // before 5AM. Next day? need to handle? { int iBod = iBarShift(NULL, 0, bod), iHR5 = iBarShift(NULL, 0, hr5), iHH = iHighest(NULL,0, MODE_HIGH, iBod - iHR5, iHR5); double HH5 = High[iHH]; } Alert(HH5); //---- return(0); }so, this is the code to get the 5:00A.m until 12:00P.m and get the highest Price...am i correct?
anthor:
so, this is the code to get the 5:00A.m until 12:00P.m and get the highest Price...am i correct?
Does it work ?
so, this is the code to get the 5:00A.m until 12:00P.m and get the highest Price...am i correct?
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Question
i m using 1H chart,and i would like to
1)get today Bar Highest and lowest Price from 12:00AM to 5:00A.M2)how to check is the trade date is today date?? using the OrderOpenTime()