Code:
string TimeStart = "08:00";
string TimeEnd = "22:00";
if (OldBar != iTime(Symbol(), Period_D1, 0) {
int candlestart = iBarShift(Symbol(), Period_M5, StrToTime(TimeStart) - 86400;
int candleend = iBarShift(Symbol(), Period_M5, StrToTime(TimeEnd) - 86400;
int candlehighest = iHighest(Symbol(), Period_M5, MODE_HIGH, candlestart-candleend, candleend);
int candlelowest = iHighest(Symbol(), Period_M5, MODE_LOW, candlestart-candleend, candleend);
double high = iHigh(Symbol(), Period_M5, candlehighest);
double low = iLow(Symbol(), Period_M5, candlelowest);
}
high und low werden nur einmal nach Tageswechsel berechnet. Durch Period_M5 ist die Berechnung auf Zeitangaben im minimal 5-Minuten-Takt beschränkt, ansonsten mit Period_M1 oder ggf. auch höheren Timeframe-Angaben.
traderdoc