Hello. I would like my expert advisor to create 2 lines, where the high and low of a certain timeframe (10:00 until 11:00) is. When compiling my code doesnt not seem to have an error, but it stops working while backtesting because array is out of range (47,70) (there is only a comment in line 47). Thank you for your help.
input color InpColor=clrRed; // Linienfarbe
input ENUM_LINE_STYLE InpStyle=STYLE_DASH; // Linienstil
input int InpWidth=2; // Linienbreite
input int Periode=PERIOD_M5;
//Eingabe der Zeiten für die ORB
input datetime Anfangszeit =D'10:00';
input datetime Endzeit =D'11:00';
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
void OnTick()
{
datetime RangeTimeBegin=StringToTime(Anfangszeit);
datetime RangeTimeEnde=StringToTime(Endzeit);
datetime timelocal= TimeLocal();
string hoursandminuteslocal=TimeToString(timelocal,TIME_MINUTES);
int AnzahlBarsBeginn=Bars(_Symbol,_Period,RangeTimeBegin,RangeTimeEnde);
// Hoch und Tief Array
double Hoch[];
double Tief[];
ArraySetAsSeries(Hoch,true);
ArraySetAsSeries(Tief,true);
CopyHigh(_Symbol,_Period,Anfangszeit, Endzeit,Hoch);
CopyLow(_Symbol,_Period,Anfangszeit,Endzeit,Tief);
//PreisInfoArray
MqlRates PriceInformation[];
ArraySetAsSeries(PriceInformation,true);
int HighestCandle;
int LowestCandle;
HighestCandle=ArrayMaximum(Hoch,1,WHOLE_ARRAY);
LowestCandle=ArrayMinimum(Tief,1,WHOLE_ARRAY);
int Data=CopyRates(Symbol(),Period(),Anfangszeit, Endzeit,PriceInformation);
//Hochlinie zeichnen
ObjectCreate(_Symbol,"Hochlinie",OBJ_HLINE,0,0,PriceInformation[HighestCandle].high);
ObjectCreate(_Symbol,"Tieflinie",OBJ_HLINE,0,0,PriceInformation[LowestCandle].low);
//Hochlinie einstellen
ObjectSetInteger(0,"Hochlinie",OBJPROP_COLOR,InpColor);
ObjectSetInteger(0,"Hochlinie",OBJPROP_WIDTH,InpWidth);
ObjectSetInteger(0,"Hochlinie",OBJPROP_STYLE,InpStyle);
//Tieflinie einstellen
ObjectSetInteger(0,"Tieflinie",OBJPROP_COLOR,InpColor);
ObjectSetInteger(0,"Tieflinie",OBJPROP_WIDTH,InpWidth);
ObjectSetInteger(0,"Tieflinie",OBJPROP_STYLE,InpStyle);
ObjectMove(0,"Hochlinie",0,0,PriceInformation[HighestCandle].high);
ObjectMove(0,"Tieflinie",0,0,PriceInformation[LowestCandle].low);
ChartRedraw(0);
}
//+------------------------------------------------------------------+