Skip to main content
On this page

ALMA Indicator: Arnaud Legoux Moving Average Settings and Strategies

· 6 min read
Pineify Team
Pine Script and AI trading workflow research team

The Arnaud Legoux Moving Average (ALMA) applies normalized Gaussian weights to a window of prices. Its length, offset and sigma control the weighting. These choices change lag and responsiveness; they do not establish that ALMA produces fewer losing signals than an SMA or EMA.

ALMA indicator

What ALMA Measures​

ALMA is the sum of each price multiplied by its weight, divided by the sum of the weights. Unlike an SMA, the observations need not receive equal weights. The offset locates the weight distribution within the window. A larger offset generally emphasizes more recent observations. TradingView's ALMA documentation describes this weighting and the default settings.

InputPineify defaultWhat to inspect
SourceCloseWhether the intended rule uses closes or another price series
Window Size9Number of observations in the calculation
Offset0.85Position of the Gaussian weight peak
Sigma6Concentration of the weights around that peak

In the usual ALMA calculation, Gaussian width is length divided by sigma. Increasing sigma narrows the weights; it does not simply make every price series smoother. The effect also depends on offset and length. Keep length and sigma positive and inspect the resulting curve when changing any parameter. These defaults are configuration values, not settings proven optimal across markets.

Add ALMA to TradingView​

How to search for and add indicator pages in the Pineify editor
  1. In Pineify's Visual Pine Editor, add ALMA from the indicator library.
  2. Set Source, Window Size, Offset and Sigma. The preset also exposes line styling.
  3. Generate the Pine Script and open TradingView's Pine Editor from the Pine icon on the right toolbar.
  4. Paste, compile and add the script to the chart. Confirm that its values agree with the intended settings before building trading rules around it.

The preset calculates ALMA; it does not by itself define entry orders, stops or notifications. Those require separate strategy or alert conditions. TradingView's editor guide covers the current editor layout.

The Best Pine Script Generator

Define a Testable ALMA Strategy​

A price crossover is a specific event. A description such as “buy a good pullback” is incomplete. Before testing, define the trend filter, the maximum distance from ALMA, the confirmation bar, the order timing and the exit. Distinguish a closed-bar signal from an intrabar condition that can disappear before the bar closes.

For a crossover experiment, compare the same entry and exit rules with ALMA, SMA and EMA on identical data and costs. Vary one parameter at a time and keep a separate evaluation period. A shorter average reacting earlier is not evidence of better net returns.

For a multi-timeframe experiment, decide whether the higher-timeframe input uses its last confirmed bar. An unfinished daily average changes during the day. Combining it with a lower-timeframe entry without accounting for that timing can make historical and live signals disagree.

Basic Crossover Example​

The following existing Pine v5 example reverses between long and short entries on price/ALMA crosses. It does not include a protective stop, commission, slippage or explicit position sizing. Configure realistic Strategy Properties and review order timing before interpreting its results. Changing input values outside valid ranges can cause errors; the example does not constrain them.

// Simple ALMA Crossover Strategy
//@version=5
strategy("ALMA Strategy", overlay=true)

// ALMA Settings
length = input.int(9, "ALMA Length")
offset = input.float(0.85, "Offset")
sigma = input.float(6, "Sigma")

// Calculate ALMA
alma = ta.alma(close, length, offset, sigma)

// Entry Conditions
long_condition = ta.crossover(close, alma)
short_condition = ta.crossunder(close, alma)

// Execute Trades
if long_condition
strategy.entry("Long", strategy.long)
if short_condition
strategy.entry("Short", strategy.short)

// Plot ALMA
plot(alma, "ALMA", color=color.blue, linewidth=2)

TradingView's strategy documentation explains broker-emulator fills and reversal behavior. Historical fills are simulated and do not certify executable live prices.

A Reclaim Condition Fragment​

// ALMA Pullback Strategy
long_setup = close > alma and close[1] < alma[1] // Pullback to ALMA
long_entry = long_setup and close > close[1] // Bounce confirmation
short_setup = close < alma and close[1] > alma[1]
short_entry = short_setup and close < close[1]

This fragment depends on the earlier alma series and creates conditions only; it submits no orders. Despite the comment calling it a pullback strategy, it tests a close crossing the average plus a change relative to the previous close. It does not establish a preceding trend, a multi-bar pullback or a volume confirmation. Use those definitions explicitly if that is the intended experiment.

Evaluate Results Without Universal Pass Thresholds​

Record net results after costs, profit factor, trade count, average win and loss, and equity drawdown. Drawdown is a decline from an equity peak to a subsequent trough, not merely the longest losing streak. Neither a particular win rate nor a fixed number of trades proves an edge; trade dependence, holding period and market coverage matter.

Check whether one instrument or event explains most of the profit. Compare nearby parameter choices, then evaluate the unchanged rules on held-out data. Repeatedly selecting the best setting on the evaluation period turns it into training data. A weak historical result is evidence about that sample, not proof of a particular future outcome.

ALMA can be combined with RSI, volume or price levels, but each additional filter is another hypothesis to test. No verified comparison here establishes a preferred market, timeframe or universal sigma setting.

Frequently Asked Questions​

What are the default ALMA settings?
Pineify's preset uses Close, length 9, offset 0.85 and sigma 6. Defaults are starting values, not validated trading recommendations.
Does a larger sigma always make ALMA smoother?
No. The usual Gaussian width is length divided by sigma, so a larger sigma concentrates weights more narrowly. The resulting behavior depends on the other inputs and the price series.
Is ALMA better than SMA or EMA?
They weight observations differently. A fair comparison requires identical trading rules, data, costs and evaluation periods. No universal performance ranking follows from the formula.
Is the crossover example ready for live trading?
It is a minimal research example without protective exits or explicit cost and sizing assumptions. Compile it, review the logic and test those assumptions before relying on its output.