Save Backtest Settings
In the "Simulated Backtest" tab (i.e., the backtesting system) of the Strategy Editing Page, you can configure options such as the backtest configuration and strategy parameters to run a strategy backtest. The backtest configuration is used to set conditions such as the backtest time range, exchanges, trading slippage, and fees; the strategy parameters are used to set the strategy's parameter options.
Once you have configured these parameters, you can run the strategy backtest according to your settings. So, how do you save these configured settings?
-
- You can use the "Save Backtest Settings" button on the Strategy Editing Page to record all backtest configuration information (including backtest settings and strategy parameter settings) as code within the strategy source code.
-
- When you click the "Save Strategy" button on the strategy editing page to save the strategy, the platform will automatically record the current backtest settings, strategy parameter configuration, and other information.
How does the backtesting system load the backtest configuration?
-
- When you refresh or reopen the strategy editing page, the system will preferentially and automatically load the backtest configuration recorded by the "Save Backtest Settings" button.
-
- If the current strategy code does not contain backtest configuration information recorded as a
backtestcomment (i.e., it was not saved in the strategy code via the "Save Backtest Settings" button), the backtesting system will automatically set the backtest configuration to the backtest settings from the last time the "Save Strategy" button was clicked for the current strategy.
- If the current strategy code does not contain backtest configuration information recorded as a
-
- If you modify the backtest configuration information recorded as a comment at the beginning of the strategy code on the strategy editing page and need to sync the updated backtest configuration to the options in the strategy backtest interface, you can click the "Backtest Settings" button above the
backtestsection in the strategy editing area.
- If you modify the backtest configuration information recorded as a comment at the beginning of the strategy code on the strategy editing page and need to sync the updated backtest configuration to the options in the strategy backtest interface, you can click the "Backtest Settings" button above the
Examples
-
When you click "Save Backtest Settings", the format in which
JavaScript/Python/C++/My Language/PINEstrategies save the backtest settings to the strategy code differs slightly:javascript/*backtest start: 2021-06-26 00:00:00 end: 2021-09-23 00:00:00 period: 1d basePeriod: 1h exchanges: [{"eid":"Binance","currency":"BTC_USDT"}] */python'''backtest start: 2021-06-26 00:00:00 end: 2021-09-23 00:00:00 period: 1d basePeriod: 1h exchanges: [{"eid":"Binance","currency":"BTC_USDT"}] '''rust/*backtest start: 2021-06-26 00:00:00 end: 2021-09-23 00:00:00 period: 1d basePeriod: 1h exchanges: [{"eid":"Binance","currency":"BTC_USDT"}] */c++/*backtest start: 2021-06-26 00:00:00 end: 2021-09-23 00:00:00 period: 1d basePeriod: 1h exchanges: [{"eid":"Binance","currency":"BTC_USDT"}] */ -
My Language:
mylang(*backtest start: 2021-06-26 00:00:00 end: 2021-09-23 00:00:00 period: 1d basePeriod: 1h exchanges: [{"eid":"Binance","currency":"BTC_USDT"}] *) -
PINE Language:
pine/*backtest start: 2021-06-26 00:00:00 end: 2021-09-23 00:00:00 period: 1d basePeriod: 1h exchanges: [{"eid":"Binance","currency":"BTC_USDT"}] */