diff --git a/src/views/Backtesting.vue b/src/views/Backtesting.vue index 5ff7d42a..13788131 100644 --- a/src/views/Backtesting.vue +++ b/src/views/Backtesting.vue @@ -85,7 +85,7 @@ v-if="btFormMode !== 'visualize' && showLeftBar" :backtest-history="botStore.activeBot.backtestHistory" :selected-backtest-result-key="botStore.activeBot.selectedBacktestResultKey" - @selectionChange="setBacktestResult" + @selectionChange="botStore.activeBot.setBacktestResultKey" /> @@ -411,9 +411,7 @@ export default defineComponent({ const pollInterval = ref(null); const sliderPosition = ref(); - const setBacktestResult = (key: string) => { - botStore.activeBot.setBacktestResultKey(key); - + const selectBacktestResult = () => { // Set parameters for this result strategy.value = botStore.activeBot.selectedBacktestResult.strategy_name; selectedTimeframe.value = botStore.activeBot.selectedBacktestResult.timeframe; @@ -422,6 +420,13 @@ export default defineComponent({ timerange.value = botStore.activeBot.selectedBacktestResult.timerange; }; + watch( + () => botStore.activeBot.selectedBacktestResultKey, + () => { + selectBacktestResult(); + }, + ); + const clickBacktest = () => { const btPayload: BacktestPayload = { strategy: strategy.value, @@ -487,7 +492,6 @@ export default defineComponent({ formatPercent, hasBacktestResult, timeframe, - setBacktestResult, strategy, selectedTimeframe, selectedDetailTimeframe,