Freqtrade - sell after x candels 1

Freqtrade – sell after x candels

from freqtrade.exchange import timeframe_to_minutes

class AwesomeStrategy(IStrategy):

    timeframe = "1d"
    timeframe_mins = timeframe_to_minutes(timeframe)
    minimal_roi = {
        "0": 0.05,                             # 5% for the first 3 candles
        str(timeframe_mins * 3)): 0.02,  # 2% after 3 candles
        str(timeframe_mins * 6)): 0.01,  # 1% After 6 candles
    }

Here is what the above code is Doing:
1. We’re creating a new class called AwesomeStrategy.
2. We’re inheriting from the IStrategy class.
3. We’re setting the timeframe to 1 day.
4. We’re setting the minimal_roi to 5% for the first 3 candles, 2% after 3 candles, and 1% after 6 candles.

Now that we have our strategy, we need to tell Freqtrade to use it.

Open the user_data/strategy/__init__.py file and add the following line:

from .awesome_strategy import AwesomeStrategy

Now, open the user_data/config.json file and add the following line:

“strategy”: “AwesomeStrategy”,

Save the file and restart Freqtrade.

You should see the following output:

2018-07-01 09:00:00,908 – freqtrade.strategy.interface – INFO – Strategy AwesomeStrategy initialized.

Congratulations! You’ve created your first strategy.

Similar Posts