PROTECTED SOURCE SCRIPT

Entropy, Liquidity, and Momentum - ELMo

Updated
ELMo is a momentum trading strategy based on two concepts: entropy and liquidity

The core concept behind the strategy is twofold: trade based on reversals in momentum based on the strength of a trend, and trade when market liquidity is beneficial to the position.

Entries and exits are determined by first calculating Shannon entropy for the time series and applying various moving averages. Separately, the Hui-Heubel Liquidity Ratio (lhh) is calculated and applied as a filter. Finally, additional conditionals such as RSI are applied to reduce false entries.

Entropy is defined as the amount of 'randomness' in a system and in this application can be thought of as a measure of the strength or weakness of a trend. The main moving averages and visible components in ELMo represent the normalized entropy score of the 'close' value (0 is series minimum, 1 is maximum). lhh will measure illiquid/fragile markets with low values and liquid/resilient markets with a high value. In general, the strategy will prefer to enter long when liquidity is high and short when liquidity is low, based off of cross events in the displayed entropy moving averages. I have published lhh as a separate indicator but it is not required for this strategy to function.

Several settings can be configured inside the strategy, including long/short bias, lookback window, MA band lengths, RSI boundaries, and more, but I have tried to choose sensible defaults that work for a large variety of situations and equities. My preferred time scales are 1m 1h 4h 1d 1w 1mo but others may work fine. Trailing stops are implemented using configurable ATR values. Additional settings are available to limit entry times (default is set to US options market open/close), and backtesting start date.

The long strategy is generally more accurate than short. Since Pinescript does not have a way to manage long/short exposure in a hedged fashion, I prefer to run two separate instances of ELMo in long-only and short-only modes for signaling. I prefer to trade this strategy with a long bias using the short signals as indications of windows of weakness where hedging could be prudent.
Release Notes
Bump version for initial release
Release Notes
v1.2
  • Add toggle to enable 24-hour entries for futures and crypto
Release Notes
Adjust cash balance in strategy to allow consistent signaling on ES_F
Release Notes
Version 1.3
  • Update default lookback to 10 (previously 16)
  • Introduce several internal variables as configurable options (here be dragons)
  • Changed default RSI values from 35/65 to 45/70
  • Added stoch high/low variables
  • Enabled 24-hour trading by default (disable if using for alerting on options market)
  • Added close ALMAs for additional trend filtering
  • Tune entry and exit conditions, including ALMA and stoch filters
  • Added Goblin Mode! Have you ever thought to yourself, "I need more risk in my life?" Well, this setting is for you! Makes entries more aggressive.
Release Notes
Update to 1.4

This is a major update and a big graphical overhaul. The previous entropy/ENTP momentum indicator has been separated from this strategy.

  • Remove ENTP chart to separate indicator, change to overlay=true to be present on main chart
  • Overhaul entry/exit conditions for a better signal to noise ratio and better responsiveness
  • Goblin mode removed
  • RSI/Stoch filter conditions removed
  • Adjust ATR Defaults
  • Adjust backtest start date
  • Remove normalization

Release Notes
v1.5

Small graphical improvements, you will need to remove and add back to your chart

  • Overlay = false, will once again run as a separate panel by default
  • Reintroduce entropy chart, update colors to be gradients of red/green and make ENTP line larger
Release Notes
Update to v2.0

  • Added entp_vol condition
  • Normalized values (0-100)
  • Streamlined settings

almaentropyliquiditymomentumstrategyTrend Analysis

Protected script

This script is published closed-source and you may privately use it freely.

Want to use this script on a chart?

Disclaimer