Skip to content
All library documents

Quickie: Short-Term Momentum Entries with Trend and Volatility Filters

Code Freqtrade

Summary

Quickie is a five-minute long-only strategy designed to enter and exit trades quickly while limiting losses with a preset stop. Its entry rule combines an ADX threshold, a rising nine-period TEMA below the Bollinger middle band, and a close below the 200-period SMA. This places entries in a strong measured trend while requiring a short-term upswing below both a volatility-band midpoint and a long-term average.

The exit rule waits for a higher ADX threshold, TEMA above the Bollinger midpoint, and TEMA turning down. The strategy also specifies time-based minimum-return targets and a 25% stop loss. These are implementation parameters, not evidence of tested performance: the document provides no backtest results, asset universe, trading costs, or rationale for the thresholds. The code assigns the same 200-period lookback to both the 200-period and nominal 50-period SMA fields, although the entry condition uses only the 200-period field. That discrepancy should be checked before relying on the implementation.

Key ideas

  • Entries require ADX above 30 and a rising TEMA below the Bollinger middle band.
  • The entry also requires price to be below the 200-period simple moving average.
  • Exits require ADX above 70 and a TEMA decline from above the Bollinger midpoint.
  • The strategy specifies a 25% stop loss and time-based minimum-return targets.
  • No performance evidence or trading-cost analysis is supplied.

Tags

Full text
# Quickie.py


```py
# --- Do not remove these libs ---
from freqtrade.strategy import IStrategy
from typing import Dict, List
from functools import reduce
from pandas import DataFrame
# --------------------------------

import talib.abstract as ta
import freqtrade.vendor.qtpylib.indicators as qtpylib


class Quickie(IStrategy):
    """

    author@: Gert Wohlgemuth

    idea:
        momentum based strategie. The main idea is that it closes trades very quickly, while avoiding excessive losses. Hence a rather moderate stop loss in this case
    """

    INTERFACE_VERSION: int = 3
    # Minimal ROI designed for the strategy.
    # This attribute will be overridden if the config file contains "minimal_roi"
    minimal_roi = {
        "100": 0.01,
        "30": 0.03,
        "15": 0.06,
        "10": 0.15,
    }

    # Optimal stoploss designed for the strategy
    # This attribute will be overridden if the config file contains "stoploss"
    stoploss = -0.25

    # Optimal timeframe for the strategy
    timeframe = '5m'

    def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
        macd = ta.MACD(dataframe)
        dataframe['macd'] = macd['macd']
        dataframe['macdsignal'] = macd['macdsignal']
        dataframe['macdhist'] = macd['macdhist']

        dataframe['tema'] = ta.TEMA(dataframe, timeperiod=9)
        dataframe['sma_200'] = ta.SMA(dataframe, timeperiod=200)
        dataframe['sma_50'] = ta.SMA(dataframe, timeperiod=200)

        dataframe['adx'] = ta.ADX(dataframe)

        # required for graphing
        bollinger = qtpylib.bollinger_bands(dataframe['close'], window=20, stds=2)
        dataframe['bb_lowerband'] = bollinger['lower']
        dataframe['bb_middleband'] = bollinger['mid']
        dataframe['bb_upperband'] = bollinger['upper']

        return dataframe

    def populate_entry_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
        dataframe.loc[
            (
                    (dataframe['adx'] > 30) &
                    (dataframe['tema'] < dataframe['bb_middleband']) &
                    (dataframe['tema'] > dataframe['tema'].shift(1)) &
                    (dataframe['sma_200'] > dataframe['close'])

            ),
            'enter_long'] = 1
        return dataframe

    def populate_exit_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
        dataframe.loc[
            (
                    (dataframe['adx'] > 70) &
                    (dataframe['tema'] > dataframe['bb_middleband']) &
                    (dataframe['tema'] < dataframe['tema'].shift(1))
            ),
            'exit_long'] = 1
        return dataframe

```

Shown in full with attribution under the source's licence. Licence: GPL-3.0

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.