private async Task _runTest(CancellationToken ct) { IsBusy = true; TickProcessor tickPro = new TickProcessor(Leverage, StartBalance); if (_summaryWin == null) { _summaryWin = new SummaryWin(); } else { _summaryWin.Reset(); } _summaryWin.Show(); try { _setProgress(); using (AlgoService algo = new AlgoService(_onMessage, TickFilePath)) { switch (AlgoType) { case 0: await algo.InitHybrid(CompleteHour, ExitLev, ObserWin, ExitLev2, Threshold1, Threshold2); break; case 1: await algo.InitDayRange(CompleteHour, ExitLev); break; case 2: await algo.InitBollinger(ObserWin, ExitLev2, Threshold1, Threshold2); break; } _setProgress(); List <Tick> ticks = await Util.ReadTickCsv(TickFilePath, StartDate, EndDate, ct); await _runTicks(ticks, algo, tickPro, ct); } } catch (OperationCanceledException) { // } catch (Exception e) { throw; } finally{ IsBusy = false; } }
private async Task _runOptimize(CancellationToken ct) { IsBusy = true; try { _setProgress(); using (AlgoService algo = new AlgoService(_onMessage, TickFilePath)) { switch (AlgoType) { case 0: await algo.InitHybrid(CompleteHour, ExitLev, ObserWin, ExitLev2, Threshold1, Threshold2); break; case 1: await algo.InitDayRange(CompleteHour, ExitLev); break; case 2: await algo.InitBollinger(ObserWin, ExitLev2, Threshold1, Threshold2); break; } int backNoDays = Convert.ToInt32((EndDate.Date - StartDate.Date).TotalDays); await algo.Optimize(EndDate, backNoDays, 128, 512); } } catch (OperationCanceledException) { // } catch (Exception e) { throw; } finally { IsBusy = false; } }
private async Task _runTest(CancellationToken ct) { IsBusy = true; TickProcessor tickPro = new TickProcessor(Leverage, StartBalance); if (_summaryWin == null) { _summaryWin = new SummaryWin(); } else { _summaryWin.Reset(); } _summaryWin.Show(); try { _setProgress(); using (AlgoService algo = new AlgoService(_onMessage, TickFilePath)) { switch (AlgoType) { case 0: await algo.InitHybrid(CompleteHour, ExitLev, ObserWin, ExitLev2, Threshold1, Threshold2); break; case 1: await algo.InitDayRange(CompleteHour, ExitLev); break; case 2: await algo.InitBollinger(ObserWin, ExitLev2, Threshold1, Threshold2); break; } _setProgress(); List<Tick> ticks = await Util.ReadTickCsv(TickFilePath, StartDate, EndDate, ct); await _runTicks(ticks, algo, tickPro, ct); } } catch (OperationCanceledException) { // } catch(Exception e) { throw; } finally{ IsBusy = false; } }