public static void TestCorrectedExtremumsFast(string toolName, int startStop, int endStop, int stopStep, int startTrStop, int endTrStop, int trStopStep, int pegTopSize) { var repository = new HistoryRepository(toolName, false); var headers = new List <string> { "Stop", "Trailing stop", "Breakeven size" }; headers.AddRange(TradesResult.GetHeaders()); var table = new List <List <string> >(); for (int stop = startStop; stop <= endStop; stop += stopStep) { for (int trStop = Math.Max(startTrStop, stop); trStop <= endTrStop; trStop += trStopStep) { for (double breakevenSize = 0.0; breakevenSize <= 0.61; breakevenSize += 0.2) { var strat = new CorrectedExtremumStrategy(stop, pegTopSize, breakevenSize, trStop); var result = strat.Run(repository.Days); result.PrintDepo(@"depo\" + stop.ToString("D4") + "_" + trStop.ToString("D4") + "_" + ((int)(100 * breakevenSize)).ToString("D2") + ".txt"); var currentText = new List <string> { stop.ToString(), trStop.ToString(), breakevenSize.ToEnString() }; currentText.AddRange(result.GetTableRow()); table.Add(currentText); } } } TablesWriter.PrintExcel("out.xlsx", headers, table); }
public static void RunCorrectedExtremums(string toolName, int stopLoss, int pegTopSize, double breakevenSize) { var repository = new HistoryRepository(toolName, false); var resultText = new List <string>(); var strat = new CorrectedExtremumStrategy(stopLoss, pegTopSize, breakevenSize, 900); var result = strat.Run(repository.Days); result.PrintDepo(@"depo\run.txt"); resultText.Add(result.ToString()); resultText.Add(""); File.WriteAllLines("out.txt", resultText); }
public static void TestTrailingCorrectedExtremums(string toolName, int stopLoss, int pegTopSize, double breakevenSize) { var repository = new HistoryRepository(toolName, false); var resultText = new List <string>(); for (int trailingSize = 700; trailingSize <= 1800; trailingSize += 100) { var strat = new CorrectedExtremumStrategy(stopLoss, pegTopSize, breakevenSize, trailingSize); var result = strat.Run(repository.Days); result.PrintDepo(@"depo\" + trailingSize + ".txt"); resultText.Add(trailingSize.ToString()); resultText.Add(result.ToString()); resultText.Add(""); } File.WriteAllLines("out.txt", resultText); }