I wanted to choose a date and receive the minimum and maximum of the daily candle.
but it's hard...
#property indicator_chart_window
extern datetime some_time = D'02.01.2017 08:00';
int start()
{
double high, low;
int shift=iBarShift(Symbol(),PERIOD_D1,some_time);
for(int i = 0; i < Bars-1; i++){
if( TimeDay( iTime(Symbol(), PERIOD_D1, i)) == TimeDay(TimeCurrent())) continue;
if( TimeDay( iTime(Symbol(), PERIOD_D1, i)) == shift){
high = MathMax(iHigh(Symbol(), PERIOD_D1, i), iHigh(Symbol(), PERIOD_D1, i+1));
low = MathMin(iLow (Symbol(), PERIOD_D1, i), iLow (Symbol(), PERIOD_D1, i+1));
break;
}
}
Comment( "High = "+high+
"\nLow = "+low);
return(0);
but it's hard...
#property indicator_chart_window
extern datetime some_time = D'02.01.2017 08:00';
int start()
{
double high, low;
int shift=iBarShift(Symbol(),PERIOD_D1,some_time);
for(int i = 0; i < Bars-1; i++){
if( TimeDay( iTime(Symbol(), PERIOD_D1, i)) == TimeDay(TimeCurrent())) continue;
if( TimeDay( iTime(Symbol(), PERIOD_D1, i)) == shift){
high = MathMax(iHigh(Symbol(), PERIOD_D1, i), iHigh(Symbol(), PERIOD_D1, i+1));
low = MathMin(iLow (Symbol(), PERIOD_D1, i), iLow (Symbol(), PERIOD_D1, i+1));
break;
}
}
Comment( "High = "+high+
"\nLow = "+low);
return(0);
Attached File(s)
candleday.mq4
< 1 KB
|
200 downloads