100 likes | 201 Views
Backtest Scenario. Scenario File. Every solution has Scenario file with MyScenario class derived from Scenario class defined in the API.Engine The Run button calls MyScenario.Run () method . This method can can be extended by users
E N D
Scenario File • Every solution has Scenario file with MyScenario class derived from Scenario class defined in the API.Engine • The Run button calls MyScenario.Run() method . This method can can be extended by users • By default MyScenario.Run() calls Scenario.Start() that starts the solution
Configure Solution Programmatically • Solution.StartDate = new DateTime(1995, 1, 1); • Solution.StopDate = new DateTime(2001, 1, 1); • Project project = Solution.Projects[0]; • project.AddInstrument(instrument); • project.Parameters["Length"].Value = 14; • Start();
Batch Backtests • Read sets of parameters from a file • Loop • Set parameters • Start() • Write results
Walk Forward Backtests • Loop • Set in-sample data interval • Optimize • Set out-of-sample data interval • Start();
Monte Carlo Backtests • Read original market data series • Create and set MC instrument • Loop • Clear historical data • Prepare MC data from original data series • Write MC data to historical db • Start() • Store results • Build MC distribution
Continuous Backtests • Set interval (Date1, Date2) • Start(); • ResetOnStart = false; • Set parameters • Set interval (Date2, Date3) • Start(); => continuous results (Date1, Date3);
From Backtest to Live trading • Set interval (Date1, Date2) • Start(); • ResetOnStart = false; • Start(Mode.Live);
Custom Optimization • Loop parameters • Set parameters • Start(); • Objective = Solution.Portfolio.GetValue(); • Set best parameters • Start();
Custom Backtest Reports • Start(); • Write • Solution.Portfolio.GetValue(); • Statistics.AnnualReturn • Statistics.Duration • Statistics.FinalWealth • Statistics.LongTrades • Statistics.LongTradesPnL • Statistics.LosingLongTrades • …