ADX-Filtered SMA Crossover Strategy for Long Entries
Summary
This hourly long-only strategy uses the Average Directional Index (ADX) to filter short-term simple moving average crossovers. It calculates ADX over 14 periods and compares a 3-period average with a 6-period average. A long entry is signaled when ADX is above 25 and the shorter average crosses above the longer one. An exit is signaled when ADX falls below 25 and the longer average crosses above the shorter one.
The strategy also specifies a 10% minimal return on investment and a 25% stop loss. These settings and indicator rules describe the implementation, but the document provides no market, backtest period, performance statistics, or evidence that the parameters are effective. It offers only long entries, so it does not define a short-selling approach. Results would depend on the traded asset, trading costs, and how the strategy framework handles its exit and risk settings.
Key ideas
- ADX above 25 filters entry signals for a short-over-long SMA crossover.
- The strategy uses 3-period and 6-period simple moving averages on an hourly timeframe.
- An exit requires ADX below 25 and an upward crossover of the longer average over the shorter one.
- The configuration specifies a 10% minimal return target and a 25% stop loss.
- The document gives no backtest results or evidence supporting the chosen thresholds.
Tags
Full text
# AdxSmas
# AdxSmas
author@: Gert Wohlgemuth
converted from:
https://github.com/sthewissen/Mynt/blob/master/src/Mynt.Core/Strategies/AdxSmas.cs
## Source (GPL-3.0)
```python
# --- 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.