I am trying to develope an indicator, which schows me the Highest High and Lowest Low from the last 12 Candles excluding the current bar.

But, when I look at the Chart, it is always showing wrong values.

I have attached a picture from the following code, does someone know, where the error is?

Thanks

protected override void OnBarUpdate() { try { if (CurrentBar < 13) return; // High der letzten 12 Kerzen bestimmen double HiHi = High[1]; if(HiHi<High[2]) HiHi=High[2]; if(HiHi<High[3]) HiHi=High[3]; if(HiHi<High[4]) HiHi=High[4]; if(HiHi<High[5]) HiHi=High[5]; if(HiHi<High[6]) HiHi=High[6]; if(HiHi<High[7]) HiHi=High[7]; if(HiHi<High[8]) HiHi=High[8]; if(HiHi<High[9]) HiHi=High[9]; if(HiHi<High[10]) HiHi=High[10]; if(HiHi<High[11]) HiHi=High[11]; if(HiHi<High[12]) HiHi=High[12]; // Low der letzten 12 Kerzen bestimmen double LoLo = Low[1]; if(LoLo>Low[2]) LoLo=Low[2]; if(LoLo>Low[3]) LoLo=Low[3]; if(LoLo>Low[4]) LoLo=Low[4]; if(LoLo>Low[5]) LoLo=Low[5]; if(LoLo>Low[6]) LoLo=Low[6]; if(LoLo>Low[7]) LoLo=Low[7]; if(LoLo>Low[8]) LoLo=Low[8]; if(LoLo>Low[9]) LoLo=Low[9]; if(LoLo>Low[10]) LoLo=Low[10]; if(LoLo>Low[11]) LoLo=Low[11]; if(LoLo>Low[12]) LoLo=Low[12]; Print(Low[1]); // Use this method for calculating your indicator values. Assign a value to each // plot below by replacing 'Close[0]' with your own formula. High.Set(HiHi); Low.Set(LoLo); } catch(Exception ex) { Print(ex.ToString()); } }

## Comment