Loading…

Tail Ratio Indicator

Average return and volatility both blend a market's up-moves and down-moves into one number. This indicator separates them at the extremes instead: it sorts the last InpWindow single-bar log returns, reads off the upper quantile (the size of a typical big up-move, at the InpTailPercentile level) and the lower quantile (the size of a typical big down-move, at the mirrored 100-InpTailPercentile level), and plots the ratio of their magnitudes. A ratio above 1.0 means this market's recent big up-moves have been larger than its big down-moves - upside carries the violence right now. A ratio below 1.0 means the reverse. This is a different read from skew of the whole distribution; it looks specifically at the tails, which is what actually determines how a stop-and-target or an option-like payoff performs, rather than the shape of the bulk of the distribution. A full sort of the window on every tick would be wasteful for anything but a short window, so - matching the step-function approach already used elsewhere in this catalogue for similar percentile work - the ratio is only recomputed once every InpRecalcBars newly closed bars and held flat between recalculations. Notes and limitations - The line is a step function, not a smooth curve - it only moves at each recalculation, by design, to bound the cost of sorting the window. - Needs a genuinely two-sided sample: a window with no usable negative quantile (e.g. an extremely one-sided trend) leaves the line blank rather than reporting a meaningless divide-by-a-near-zero result. - Uses close-to-close log returns on the chart's own timeframe; it does not use intrabar high/low extremes. - Describes the recent shape of returns only. It does not predict which side will carry the next extreme move, and it does not size a position.

Indicator · MT4 · v1.0 · Free

About Tail Ratio Indicator

Tail Ratio Indicator is an indicator for MetaTrader 4. It has 3 settings, such as Window, Tail percentile and Recalc bars. MQL source code included.

Files in the download: TailRatioIndicator.mq4, TailRatioIndicator.txt.

Settings

SettingDefaultWhat it does
Window100Bars of trailing returns sampled for each quantile pair
Tail percentile95Percentile defining the tail (95 = top/bottom 5%)
Recalc bars10Recompute the ratio every this many newly closed bars

How to install

  1. Download the ZIP from your PolyMaria library and unzip it.
  2. In MetaTrader 4 open File → Open Data Folder, then go to MQL4 → Indicators.
  3. Copy the .mq4 file(s) there. Put any .mqh files in MQL4 → Include.
  4. Open the .mq4 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
  5. Drag the indicator from the Navigator onto a chart and adjust the settings.

Download the PDF guide

Tags: Trailing Stop & Break-even · MT4 Indicator · MQL4 Source Code

MetaTrader 4 & 5 indicators · PolyMaria