FXR MA Trend
- Indicators
- Version: 1.0
FXR MA Trend is a chart-window indicator that draws a ribbon of six moving averages,
optionally calculated on a different (structure) timeframe, and visualizes the ribbon's
state: trend-colored candles, flip markers (arrows), an on-chart information panel and
optional alerts.
It is a visualization and market-reading tool. It does not place trades, manage
positions, or predict price. Signals are state changes of a moving-average ribbon —
lagging by construction — and are not trade recommendations.
What it draws
- Ribbon — six moving-average lines. Line lengths are Base, Base+Spacing, ... ,
Base+5×Spacing (defaults: 40 with spacing 8 → 40/48/56/64/72/80). The fastest line
is drawn thicker. Line colors fade from the fastest to the slowest line by blending
toward the chart background, so the ribbon reads as one object. Colors follow the
current trend state and adapt automatically when you change the chart's color theme. - Trend candles (optional). Candles are overdrawn in the bullish/bearish color
while the ribbon state is up/down. - Flip markers (optional). An arrow is plotted on the bar where the trend state
flips (see "Signals" for the exact definition). Position: hugging the candles, or
riding the outer edge of the ribbon with an ATR(14)-based offset. - Information panel (optional). A compact on-chart box showing: current trend,
structure timeframe, MA source/type, lengths, active signal mode, last signal and
bars since the flip, ribbon expansion/compression, and a "Strength" percentage.
Three detail levels (Small / Medium / Large) and six screen positions.
Moving-average engine
Ten MA types are implemented from scratch (no external libraries): SMA, EMA, WMA,
HMA (Hull), RMA (Wilder), VWMA (volume-weighted), DEMA, TEMA, ALMA (Arnaud Legoux,
with offset/sigma inputs) and LSMA (least-squares regression, with a bar-offset input).
Eight price sources: Close, Open, High, Low, HL2, HLC3, OHLC4, HLCC4.
Implementation notes, stated plainly:
- EMA, RMA, DEMA and TEMA are seeded with the SMA of their first L values. Values
during the first few periods of history may differ slightly from platforms that use
a different seeding convention; they converge as history grows. - VWMA uses tick volume (the volume available in the terminal for most symbols).
- Each line stays empty (not drawn) until it has enough bars to be mathematically
valid — the indicator does not fake warm-up values.
Structure timeframe (multi-timeframe)
The ribbon can be calculated on any timeframe, not just the chart's. On a lower-TF
chart, each chart bar shows the structure-TF ribbon value at that bar's close, either
as smooth interpolated ramps or as an exact staircase (input). Structure-TF data is
copied and cached, and recalculated at most every 5 seconds or when a new structure
bar opens. If structure-TF history is not available yet (fresh symbol, deep LTF
chart), the indicator falls back to the chart timeframe and logs one message, instead
of drawing nothing.
Signals — exact definitions
The trend state is computed per bar in one of two modes:
- Ribbon Flip (default): state is bullish while the fastest line is above the
slowest line, bearish while it is below. - Fastest MA Slope: state follows the direction of the fastest line versus its
previous bar.
A Buy marker appears on the bar where the state changes from established bearish
to bullish; a Sell marker on the change from established bullish to bearish. A
trend emerging from an unknown/flat warm-up state does not produce a marker — the
first marker appears at the first genuine flip.
Honest behavior notes:
- Markers and candle colors on the forming bar update with every tick and can
change or disappear before the bar closes. This is how any live indicator behaves;
nothing here is "non-repainting", and no such claim is made. - With a structure timeframe, chart bars belonging to the currently forming
structure bar track the live structure-bar value; their state can change until that
structure bar closes. - Alerts (popup / push / email / sound) can optionally be restricted to the last
closed bar ("Confirm Signals On Bar Close", on by default). Each direction
alerts at most once per bar. After a chart reload or timeframe switch, the last
closed bar's signal may alert one more time, because the alert-dedupe state is
in-memory. - Alert text shows the chart symbol and chart timeframe.
- MA crossovers are lagging. In ranging markets this style of signal flips often and
will produce consecutive losing streaks of state changes like any crossover system.
That is a property of moving averages, not a defect this indicator can remove.
Information panel figures
- Strength % = current distance between the fastest and slowest ribbon lines,
divided by the maximum such distance over the last "Momentum Normalization Length"
bars (default 100). It is a descriptive normalization of ribbon width within the
recent window. It is not a probability, not a confidence score, and not predictive. - Ribbon = "Expanding" when the fastest–slowest distance grew versus the previous
bar, otherwise "Compressing". - Bars Since Flip = closed bars since the last state flip inside the calculation
window.
Performance
The indicator recalculates the visible window every tick. The window is limited by
"Max Bars To Calculate" (default 5,000, range 100–20,000), plus an internal warm-up
region before it. On multi-timeframe settings, structure-TF calculations are cached
as described above, and an internal cap prevents pathological combinations (e.g. M1
chart with monthly structure) from requesting unreasonable amounts of data. On slow
machines or heavy tick streams, reduce Max Bars To Calculate.
Default settings
| Input | Default | Input | Default |
|---|---|---|---|
| Structure Timeframe | Current | MA Type | HMA |
| Source | Close | Base Length / Spacing | 40 / 8 (min spacing 1) |
| Signal Trigger | Ribbon Flip | Confirm On Bar Close | true |
| Arrows / Colored Candles | on / on | Arrow Position | Ribbon edge (0.5 × ATR14) |
| Info Box | on, Large, Top-Left | Strength Window | 100 bars |
| Popup Alert | on | Push / Email / Sound | off |
| Max Bars To Calculate | 5,000 | HTF Line Style | Smooth |
Limitations (known and accepted)
- Signals lag; they describe the ribbon, not the future.
- Markers on the forming bar are provisional until the bar closes; MTF states are
provisional until the structure bar closes. - The information panel uses fixed object names — run one instance with the info box
per chart. - VWMA relies on tick volume.
- "Strength %" depends on the chosen normalization window and is comparable only to
itself.
What this product is not
Not an expert advisor. No automated or semi-automated trading. No backtest results,
win rates or performance figures are provided or implied, because none are claimed.
No repainting-free, accuracy or profitability claims of any kind.
Disclaimer
This indicator is provided free of charge for educational and chart-visualization
purposes only. It is not financial, investment or trading advice. Trading leveraged
products such as forex and CFDs carries a high risk of losing money rapidly. Any
decision to trade is yours alone; past indicator behavior does not determine future
results. Test any settings on a demo account first. The author accepts no liability
for trading decisions or losses.

User didn't leave any comment to the rating