private void RunEvolve() { _CurrentStart = _Periods[0].Start; _CurrentEnd = _Periods[0].End; var firstSeq = RunAlgo().GetSequence(); _Periods[0].Seq = firstSeq; for (int x = 1; x < _Periods.Count; x++) { _Periods[x].Seq_prev = _Periods[x - 1].Seq; _Periods[x].Seq = RunAlgo().GetSequence(); var s = new AlgoSecondLayer.StochPOP(); s.StartDate = _Periods[x].Start; s.EndDate = _Periods[x].End; _CurrentStart = _Periods[x].Start; _CurrentEnd = _Periods[x].End; var o = s.Start(_Periods[x].Seq_prev, null, true); _Periods[x].Profit = double.Parse(o[1]); _Periods[x].TradeCount = int.Parse(o[2]); } Console.WriteLine("Stop"); Console.ReadLine(); }
private void RunEvolve() { _CurrentStart = _Periods[0].Start; _CurrentEnd = _Periods[0].End; var firstSeq = RunAlgo().GetSequence(); _Periods[0].Seq = firstSeq; for (int x = 1; x < _Periods.Count; x++) { _Periods[x].Seq_prev = _Periods[x - 1].Seq; _Periods[x].Seq = RunAlgo().GetSequence(); var s = new AlgoSecondLayer.StochPOP(); s.StartDate = _Periods[x].Start; s.EndDate = _Periods[x].End; _CurrentStart = _Periods[x].Start; _CurrentEnd = _Periods[x].End; var o = s.Start(_Periods[x].Seq_prev, null, true); _Periods[x].Profit= double.Parse(o[1]); _Periods[x].TradeCount = int.Parse(o[2]); } Console.WriteLine("Stop"); Console.ReadLine(); }
public double theActualFunction(double[] values) { if (values.GetLength(0) != 9) { throw new ArgumentOutOfRangeException("should only have 9 args"); } var bb = @" this.Fast_K = int.Parse(s[0]); this.Slow_K = int.Parse(s[1]); this.Slow_D = int.Parse(s[2]); this.UPPER_75 = int.Parse(s[3]); this.LOWER_25 = int.Parse(s[4]); this.LIMIT_HIGH = int.Parse(s[5]); this.LIMIT_LOW = int.Parse(s[6]); this.STOPLOSS = int.Parse(s[7]); this.TAKEPROFIT = int.Parse(s[8]); this.CLOSE_END_OF_DAY = false;"; double a = values[0]; double b = values[1]; double c = values[2]; double d = values[3]; double e = values[4]; double f = values[5]; double g = values[6]; double h = values[7]; double i = values[8]; // double f1 = Math.Pow(15 * x * y * (1 - x) * (1 - y) * Math.Sin(n * Math.PI * x) * Math.Sin(n * Math.PI * y), 2); //return f1; var seq = ((int)a).ToString() + "," + ((int)b).ToString() + "," + ((int)c).ToString() + "," + ((int)d).ToString() + "," + ((int)e).ToString() + "," + ((int)f).ToString() + "," + ((int)g).ToString() + "," + ((int)h).ToString() + "," + ((int)i).ToString(); var s = new AlgoSecondLayer.StochPOP(); s.StartDate = _CurrentStart; s.EndDate = _CurrentEnd;; var o = s.Start(seq, null, true); //AddOutput("=================", true); //AddOutput("Sequence " + o[0], true); //AddOutput("Profit " + o[1], true); //AddOutput("Trades " + o[2], true); double profit = double.Parse(o[1]); double trades = double.Parse(o[2]); double avg = profit / (trades + 1); if (trades == 0) { return(1); } else { return(profit); } }
public double theActualFunction(double[] values) { if (values.GetLength(0) != 9) throw new ArgumentOutOfRangeException("should only have 9 args"); var bb = @" this.Fast_K = int.Parse(s[0]); this.Slow_K = int.Parse(s[1]); this.Slow_D = int.Parse(s[2]); this.UPPER_75 = int.Parse(s[3]); this.LOWER_25 = int.Parse(s[4]); this.LIMIT_HIGH = int.Parse(s[5]); this.LIMIT_LOW = int.Parse(s[6]); this.STOPLOSS = int.Parse(s[7]); this.TAKEPROFIT = int.Parse(s[8]); this.CLOSE_END_OF_DAY = false;"; double a = values[0]; double b = values[1]; double c = values[2]; double d = values[3]; double e = values[4]; double f = values[5]; double g = values[6]; double h = values[7]; double i = values[8]; // double f1 = Math.Pow(15 * x * y * (1 - x) * (1 - y) * Math.Sin(n * Math.PI * x) * Math.Sin(n * Math.PI * y), 2); //return f1; var seq = ((int)a).ToString() + "," + ((int)b).ToString() + "," + ((int)c).ToString() + "," + ((int)d).ToString() + "," + ((int)e).ToString() + "," + ((int)f).ToString() + "," + ((int)g).ToString() + "," + ((int)h).ToString() + "," + ((int)i).ToString(); var s = new AlgoSecondLayer.StochPOP(); s.StartDate = _CurrentStart; s.EndDate = _CurrentEnd; ; var o = s.Start(seq, null, true); //AddOutput("=================", true); //AddOutput("Sequence " + o[0], true); //AddOutput("Profit " + o[1], true); //AddOutput("Trades " + o[2], true); double profit = double.Parse(o[1]); double trades = double.Parse(o[2]); double avg = profit / (trades + 1); if (trades == 0) return 1; else return profit ; }