From 5c4014ee624f3e8e5c16a2036e7d8a4e680a69e4 Mon Sep 17 00:00:00 2001 From: robcaulk Date: Mon, 23 May 2022 10:24:58 +0200 Subject: [PATCH] Change default value of process_only_new_candles to True since False is an uncommon usecase for expert strategy devs --- docs/configuration.md | 2 +- freqtrade/strategy/interface.py | 2 +- freqtrade/templates/base_strategy.py.j2 | 2 +- freqtrade/templates/sample_strategy.py | 2 +- tests/strategy/test_strategy_loading.py | 6 +++--- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/configuration.md b/docs/configuration.md index 43151f51c..0f3069478 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -140,7 +140,7 @@ Mandatory parameters are marked as **Required**, which means that they are requi | `dry_run` | **Required.** Define if the bot must be in Dry Run or production mode.
*Defaults to `true`.*
**Datatype:** Boolean | `dry_run_wallet` | Define the starting amount in stake currency for the simulated wallet used by the bot running in Dry Run mode.
*Defaults to `1000`.*
**Datatype:** Float | `cancel_open_orders_on_exit` | Cancel open orders when the `/stop` RPC command is issued, `Ctrl+C` is pressed or the bot dies unexpectedly. When set to `true`, this allows you to use `/stop` to cancel unfilled and partially filled orders in the event of a market crash. It does not impact open positions.
*Defaults to `false`.*
**Datatype:** Boolean -| `process_only_new_candles` | Enable processing of indicators only when new candles arrive. If false each loop populates the indicators, this will mean the same candle is processed many times creating system load but can be useful of your strategy depends on tick data not only candle. [Strategy Override](#parameters-in-the-strategy).
*Defaults to `false`.*
**Datatype:** Boolean +| `process_only_new_candles` | Enable processing of indicators only when new candles arrive. If false each loop populates the indicators, this will mean the same candle is processed many times creating system load but can be useful of your strategy depends on tick data not only candle. [Strategy Override](#parameters-in-the-strategy).
*Defaults to `true`.*
**Datatype:** Boolean | `minimal_roi` | **Required.** Set the threshold as ratio the bot will use to exit a trade. [More information below](#understand-minimal_roi). [Strategy Override](#parameters-in-the-strategy).
**Datatype:** Dict | `stoploss` | **Required.** Value as ratio of the stoploss used by the bot. More details in the [stoploss documentation](stoploss.md). [Strategy Override](#parameters-in-the-strategy).
**Datatype:** Float (as ratio) | `trailing_stop` | Enables trailing stoploss (based on `stoploss` in either configuration or strategy file). More details in the [stoploss documentation](stoploss.md#trailing-stop-loss). [Strategy Override](#parameters-in-the-strategy).
**Datatype:** Boolean diff --git a/freqtrade/strategy/interface.py b/freqtrade/strategy/interface.py index 57afbf32a..473e58e6a 100644 --- a/freqtrade/strategy/interface.py +++ b/freqtrade/strategy/interface.py @@ -82,7 +82,7 @@ class IStrategy(ABC, HyperStrategyMixin): } # run "populate_indicators" only for new candle - process_only_new_candles: bool = False + process_only_new_candles: bool = True use_exit_signal: bool exit_profit_only: bool diff --git a/freqtrade/templates/base_strategy.py.j2 b/freqtrade/templates/base_strategy.py.j2 index 9e7e1fe50..d393574d9 100644 --- a/freqtrade/templates/base_strategy.py.j2 +++ b/freqtrade/templates/base_strategy.py.j2 @@ -64,7 +64,7 @@ class {{ strategy }}(IStrategy): # trailing_stop_positive_offset = 0.0 # Disabled / not configured # Run "populate_indicators()" only for new candle. - process_only_new_candles = False + process_only_new_candles = True # These values can be overridden in the config. use_exit_signal = True diff --git a/freqtrade/templates/sample_strategy.py b/freqtrade/templates/sample_strategy.py index f0ae6c10d..1b375714a 100644 --- a/freqtrade/templates/sample_strategy.py +++ b/freqtrade/templates/sample_strategy.py @@ -62,7 +62,7 @@ class SampleStrategy(IStrategy): timeframe = '5m' # Run "populate_indicators()" only for new candle. - process_only_new_candles = False + process_only_new_candles = True # These values can be overridden in the config. use_exit_signal = True diff --git a/tests/strategy/test_strategy_loading.py b/tests/strategy/test_strategy_loading.py index 3ed1eb0ce..919a4bd00 100644 --- a/tests/strategy/test_strategy_loading.py +++ b/tests/strategy/test_strategy_loading.py @@ -224,12 +224,12 @@ def test_strategy_override_process_only_new_candles(caplog, default_conf): default_conf.update({ 'strategy': CURRENT_TEST_STRATEGY, - 'process_only_new_candles': True + 'process_only_new_candles': False }) strategy = StrategyResolver.load_strategy(default_conf) - assert strategy.process_only_new_candles - assert log_has("Override strategy 'process_only_new_candles' with value in config file: True.", + assert not strategy.process_only_new_candles + assert log_has("Override strategy 'process_only_new_candles' with value in config file: False.", caplog)