ADX and SMA Crossovers for Long Entries and Exits
Summary
This hourly long-only strategy combines the Average Directional Index (ADX) with two simple moving averages. It calculates a 14-period ADX and 3-period and 6-period SMAs. A long entry is signaled when ADX is above 25 and the shorter SMA crosses above the longer one. An exit is signaled when ADX falls below 25 and the longer SMA crosses above the shorter one.
The document also sets a 10% minimal return on investment target and a 25% stop loss. It provides strategy rules and configuration, but no backtest results, market-specific evidence, or rationale for the parameter choices. The signals therefore describe a testable trend-oriented approach rather than demonstrating profitability; results may depend on the asset, execution, and parameter settings.
Key ideas
- The strategy uses ADX above 25 as a condition for entering a long trade.
- A 3-period SMA crossing above a 6-period SMA triggers a qualifying entry.
- An exit requires ADX below 25 and the 6-period SMA crossing above the 3-period SMA.
- The strategy operates on hourly data and specifies a 10% ROI target and a 25% stop loss.
Tags
Full text
# AdxSmas.py
```py
# --- Do not remove these libs ---
from freqtrade.strategy import IStrategy
from pandas import DataFrame
import talib.abstract as ta
import freqtrade.vendor.qtpylib.indicators as qtpylib
# --------------------------------
class AdxSmas(IStrategy):
"""
author@: Gert Wohlgemuth
converted from:
https://github.com/sthewissen/Mynt/blob/master/src/Mynt.Core/Strategies/AdxSmas.cs
"""
INTERFACE_VERSION: int = 3
# Minimal ROI designed for the strategy.
# adjust based on market conditions. We would recommend to keep it low for quick turn arounds
# This attribute will be overridden if the config file contains "minimal_roi"
minimal_roi = {
"0": 0.1
}
# Optimal stoploss designed for the strategy
stoploss = -0.25
# Optimal timeframe for the strategy
timeframe = '1h'
def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
dataframe['adx'] = ta.ADX(dataframe, timeperiod=14)
dataframe['short'] = ta.SMA(dataframe, timeperiod=3)
dataframe['long'] = ta.SMA(dataframe, timeperiod=6)
return dataframe
def populate_entry_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
dataframe.loc[
(
(dataframe['adx'] > 25) &
(qtpylib.crossed_above(dataframe['short'], dataframe['long']))
),
'enter_long'] = 1
return dataframe
def populate_exit_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
dataframe.loc[
(
(dataframe['adx'] < 25) &
(qtpylib.crossed_above(dataframe['long'], dataframe['short']))
),
'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.