From 0f7ddabec80428e80f036618e65d4e72d7605af7 Mon Sep 17 00:00:00 2001 From: Matthias Date: Sat, 14 Aug 2021 09:05:03 +0200 Subject: [PATCH] Slightly reword documentation --- docs/bot-basics.md | 5 +++-- docs/strategy-advanced.md | 24 +++++++++++++++--------- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/docs/bot-basics.md b/docs/bot-basics.md index 943af0362..b34594f46 100644 --- a/docs/bot-basics.md +++ b/docs/bot-basics.md @@ -36,11 +36,12 @@ By default, loop runs every few seconds (`internals.process_throttle_secs`) and * Calls `check_sell_timeout()` strategy callback for open sell orders. * Verifies existing positions and eventually places sell orders. * Considers stoploss, ROI and sell-signal. - * Determine sell-price based on `ask_strategy` configuration setting. + * Determine sell-price based on `ask_strategy` configuration setting or by using the `custom_exit_price()` callback. * Before a sell order is placed, `confirm_trade_exit()` strategy callback is called. * Check if trade-slots are still available (if `max_open_trades` is reached). * Verifies buy signal trying to enter new positions. - * Determine buy-price based on `bid_strategy` configuration setting. + * Determine buy-price based on `bid_strategy` configuration setting, or by using the `custom_entry_price()` callback. + * Determine stake size by calling the `custom_stake_amount()` callback. * Before a buy order is placed, `confirm_trade_entry()` strategy callback is called. This loop will be repeated again and again until the bot is stopped. diff --git a/docs/strategy-advanced.md b/docs/strategy-advanced.md index 17fdddc37..e53f20693 100644 --- a/docs/strategy-advanced.md +++ b/docs/strategy-advanced.md @@ -359,14 +359,15 @@ See [Dataframe access](#dataframe-access) for more information about dataframe u ## Custom order price rules -By default, freqtrade use the orderbook to automatically set an order price, you also have the option to create custom order prices based on your strategy. +By default, freqtrade use the orderbook to automatically set an order price([Relevant documentation](configuration.md#prices-used-for-orders)), you also have the option to create custom order prices based on your strategy. -You can use this feature by creating a custom_entry_price function in your strategy file to customize entry prices and custom_exit_price for exits. +You can use this feature by creating a `custom_entry_price()` function in your strategy file to customize entry prices and custom_exit_price for exits. -!!!Note -If your custom pricing function return None or an invalid value, a default entry or exit price will be chosen based on the current rate. +!!! Note + If your custom pricing function return None or an invalid value, price will fall back to `proposed_rate`, which is based on the regular pricing configuration. + +### Custom order entry and exit price example -### Custom order entry and exit price exemple ``` python from datetime import datetime, timedelta, timezone from freqtrade.persistence import Trade @@ -380,9 +381,9 @@ class AwesomeStrategy(IStrategy): dataframe, last_updated = self.dp.get_analyzed_dataframe(pair=pair, timeframe=self.timeframe) - proposed_entryprice = dataframe['bollinger_10_lowerband'].iat[-1] + new_entryprice = dataframe['bollinger_10_lowerband'].iat[-1] - return proposed_entryprice + return new_entryprice def custom_exit_price(self, pair: str, trade: Trade, current_time: datetime, proposed_rate: float, @@ -390,12 +391,17 @@ class AwesomeStrategy(IStrategy): dataframe, last_updated = self.dp.get_analyzed_dataframe(pair=pair, timeframe=self.timeframe) - proposed_exitprice = dataframe['bollinger_10_upperband'].iat[-1] + new_exitprice = dataframe['bollinger_10_upperband'].iat[-1] - return proposed_exitprice + return new_exitprice ``` +!!! Warning + Modifying entry and exit prices will only work for limit orders. Depending on the price chosen, this can result in a lot of unfilled orders. + +!!! Warning "No backtesting support" + Custom entry-prices are currently not supported during backtesting. ## Custom order timeout rules