Can some one say me, why i can't get history bars in my method "priceUpOrDownORFlat()"?
I'm always recieve exception "ArgumetOutOfRangeException".
Here my indicator code:
protected override void OnBarUpdate() { DataSeries inp = new DataSeries(this); // Use this method for calculating your indicator values. Assign a value to each // plot below by replacing 'Close[0]' with your own formula. String trend = priceUpOrDownORFlat(inp); if (trend.IndexOf('u')!=-1) { Plot0.Set(High[0]); } else if (trend.IndexOf('d')!=-1) { Plot0.Set(Low[0]); } else { Plot0.Set((High[0]+Low[0])/2); } Plot0.Set(Close[0]); } private String priceUpOrDownORFlat(DataSeries input) { // u- up, d- down, f- flat String tr = "f"; double[] arr = new double[3]; for (int i = 3; i >= 1; i--) { arr.SetValue(((input.Indicator.High[i] + input.Indicator.Low[i])/2),(int)(i-1)); } if((double)arr[2]>=(double)arr[1] && (double)arr[1]>=(double)arr[0]) { tr = "d"; } else if((double)arr[2]<=(double)arr[1] && (double)arr[1]<=(double)arr[0]) { tr = "u"; } else { tr = "f"; } return tr; }
Comment