Loading...

Plus+ Python

Filtered ADX Gapper Trading Strategy Code & Signals: Python

Filtered ADX Gapper Trading Strategy Code & Signals: Python


Strategy Description
According to the way it is described in the book "Street Smarts: High Probability Short-Term Trading Strategies" by Laurence A. Connors and Linda Bradford Raschke, this strategy is a retracement pattern that provides a good entry into a trending market. The strategy uses two technical indicators: ADX and +DI/-DI. The Average Directional Index (ADX) and the Positive/Negative Directional Indicators (+DI/-DI) are used to measure the strength and direction of a market trend. ADX measures the strength of the trend, regardless of the direction. And the directional indicators, as they name may imply, are used to determine the direction of the trend.

Strategy Rules and Conditions
  • Todays' opening price must gap below previous days' low for buys and gap above yesterdays' high for sells
  • Buy order is placed at or slightly above previous day low
  • ADX must be greater than 30
  • For buy signal, the +DI must be greater than the -DI (+DI > -DI = BUY )
  • For sell signal, the -DI must be greater than the +DI (-DI > +DI = SELL )
  • The 12 period ADX is used & 28 period +DI/-DI

    The Code
    This strategy will use Bitcoin historical data from Binance as an example for how to implement. We have left all of the additional columns in the code: both technical indicators and the final signals. This strategy is dependent for gaps in price from one period to another. In cryptocurrency, the market trades 24 hours a day and 7 days a week, so in theory there should never really be "gaps" and strong liquidity in Bitcoin markets keep it this way. We have included an extra column called "Gap_size" that calculates the absolute difference in close-> open price day over day. It would make sense to include a trigger on this condition to ensure a minimum gap size. However, other ALT markets or lower market caps may experience more price gaps. We use the technical analysis library talib to add ADX and DI+ / DI- indicators to our Pandas DataFrame. Logic is then added to use these columns to produce a "Buy Signal" or "Sell Signal", and the results are saved to a csv filed called "ADX_gapper_strategy.csv". Every line of code is commented; feel free to modify to fit your purpose

  • Plus+ membership required

    Create a Plus+ account to view the live codebase.

    This article has a fully working, notebook-ready code block. Sign up for Plus+ to access it and the rest of the 20+ premium articles.

    Subscribe to Plus+ Browse Plus+ articles