TradingCharts
IndicatorProtectedv1

Intraday EMA [Spark Algo] SAMA

What it does

SAMA — Session-Anchored Moving Average

An intraday-only dual EMA that resets every trading session. On the session's first close the average is seeded from that close, so nothing carries over from yesterday.

WHY IT IS DIFFERENT

Early bars hug price and react to the opening auction; the line then smooths into a true EMA. No artificial flat start, no carry-over contamination, no jump when a fixed-length EMA switches on.

The length is not fixed at the open — it ramps with the session:

• Next session: restarts from the new first close

ON THE CHART

• Fast Session EMA — green at or above the slow EMA, red below (colours off price when the slow EMA is disabled)

• Slow Session EMA — optional second average, same reset engine

• Session EMA Cloud — filled between the two, tinted by trend state

• Crossover markers — triangles on fast/slow crosses

HOW TO USE

• Fast above slow with a bullish cloud: intraday bias up, pullbacks to the fast EMA are continuation zones

• Fast below slow with a bearish cloud: bias down, rallies into the fast EMA are fade zones

• Crossovers are timing signals, not standalone entries — they are suppressed on the reset bar, so the first marker of the day only appears once both averages have real session data

• On a flat or gapped open the lines sit close together for the first few bars: that is the warm-up, not a signal

SETTINGS

Fast: length 9, source close, bull/bear #089981 / #f23645, width 1

Slow: enabled, length 21, colour #2962ff, width 1

Visuals: crossover signals on, cloud fill on

Session reset: custom window off — resets on every new exchange trading day; session 0915-1530, timezone UTC+5:30

Turning the custom window on re-seeds the EMA whenever price moves from outside the window to inside it. Useful for futures

How to use it

  • Open the charts and go to Indicators › My scripts › Shared with me (or search the Community library) and press Add to chart.
  • The code is protected by the author: the script runs on the chart with the source hidden.

Version history

  • v1 — 29 Nov, 03:08 pm · compiler 0.3.70

#movingaverage