potato_hedge

Entropy, Liquidity, and Momentum - ELMo

potato_hedge מעודכן   
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.
הערות שחרור:
Bump version for initial release
הערות שחרור:
v1.2
  • Add toggle to enable 24-hour entries for futures and crypto
הערות שחרור:
Adjust cash balance in strategy to allow consistent signaling on ES_F
הערות שחרור:
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.
הערות שחרור:
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
הערות שחרור:
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
סקריפט מוגן
סקריפט זה פורסם במקור סגור ותוכל להשתמש בו באופן חופשי. אתה יכול להגדירו כמועדף כדי להשתמש בו בגרף. אינך יכול להציג או לשנות את קוד המקור שלו.
כתב ויתור

המידע והפרסומים אינם אמורים להיות, ואינם מהווים, עצות פיננסיות, השקעות, מסחר או סוגים אחרים של עצות או המלצות שסופקו או מאושרים על ידי TradingView. קרא עוד בתנאים וההגבלות.

רוצה להשתמש בסקריפ זה בגרף?