Linear Weighted Moving Average LWMA: Settings and Signals
A conventional linear weighted moving average assigns larger positive weights to newer observations. Pineify's component named Linear Weighted Moving Average adds a separate Weight input and uses a different coefficient formula. Check which calculation you want before comparing settings or trading signals: the two are not interchangeable.

Conventional LWMA and the Pineify Variant
A conventional N-period LWMA uses weights 1 through N from oldest to newest:
Weighted sum / sum of weights, with denominator N × (N + 1) / 2.
Pineify's current component instead gives the observation at index i, where zero is the newest bar, a coefficient of Weight − i − (Weight / Period − 1). It divides the weighted sum by the sum of those coefficients. Its defaults are Period 10 and Weight 6.
Under v6 division semantics, those defaults produce coefficients from 6.4 down to −2.6. Some older observations therefore have negative weights. This is not an ordinary convex average and its output can lie outside the observed input range. A Weight value should not be described as a simple universal “speed” control.
| Calculation | Weight structure | What to compare |
|---|---|---|
| SMA | Equal positive weights over the window | Mean of the selected observations |
| Conventional WMA | Positive weights increasing toward the newest observation | Defined finite-window weighting |
| EMA | Recursive exponential smoothing | Length convention and initialization |
| Pineify LWMA variant | Configurable arithmetic coefficients, potentially negative | Exact Period/Weight pair and denominator |
No general claim of better signals or greater profitability follows from any of these weighting schemes. If you require conventional WMA, verify that the chosen component or script implements that formula.
Add the Component to TradingView
- Find Linear Weighted Moving Average in Pineify's indicator library.
- Record source, Period, and Weight; identify whether this variant is appropriate for your intended calculation.
- Generate the script and open Pine Editor in TradingView.
- Check compilation, add it to the chart, and inspect numeric values rather than relying on visual smoothness.
- Compare a short hand-calculated window with the output before using its signals in a strategy.
Generation does not guarantee error-free code or correct trading behavior. Check current account access and plan terms separately rather than assuming every workflow is free.
Read the Signals Precisely
The component exposes the line, rising/falling states, and buy/sell events. Rising means the current line exceeds the previous value. A buy event occurs when rising becomes true after it was not true; the corresponding sell event begins a falling state.
This includes a transition from flat to rising, not only a direct falling-to-rising reversal. Color can represent a state across many bars; it is not necessarily a fresh order event. The current bar's calculation may change before close.
A chart's apparent angle also depends on scale and zoom. Define slope thresholds numerically if the strategy needs them. A steep display does not establish a particular rate of return or institutional activity.
Settings as Controlled Experiments
Begin by checking coefficient signs and denominator behavior for a proposed Period/Weight pair. A zero or near-zero denominator can make a weighted ratio undefined or unstable; do not assume every input combination is meaningful.
For a conventional WMA comparison, hold length, source, entry rule, exit rule, and costs fixed. For the Pineify variant, document both inputs and do not transfer conclusions from a standard WMA study without checking the formulas.
Timeframe changes alter the time span covered by a fixed number of bars. Short intervals require careful spread and turnover assumptions; long intervals may leave few trades after warm-up. Neither implies a universal best parameter range.
A Testable Trading Baseline
An educational long-only experiment can enter on a completed buy event when flat and exit on a completed sell event. Model entries on the next available bar open, allow one position, and define protective stops independently if used. Record how unavailable warm-up values are handled.
To study a price filter, add actual close above the line while keeping the exit and sizing rules unchanged. Count removed winners as well as removed losses. Additional filters can reduce exposure without improving returns.
For support/resistance or divergence ideas, specify exact price levels and pivot-confirmation timing. A moving average is a calculated reference; it does not force price to bounce from it. A historical marker placed at a pivot must not backdate the decision.
Backtesting and Risk
Save the script version, formula, settings, instrument, dates, chart type, entry timing, exits, quantity, and transaction costs. Use TradingView's strategy documentation to inspect fill and calculation assumptions.
Compare net outcomes, drawdown, exposure, trade count, and average win/loss. There is no universal minimum Sharpe ratio, profit factor, or expected win rate that makes this strategy suitable. A small sample can produce attractive statistics by chance.
Reserve later data before selecting parameters. Check signal behavior after a reload and on new completed bars. A syntax check is separate from runtime, repainting, and economic validation.
Frequently Asked Questions
Is Pineify's LWMA the conventional 1-to-N weighted average?
Not in the current component. It exposes a separate Weight input and uses arithmetic coefficients that can be negative. Verify the exact formula before comparing it with conventional WMA.
Are Period 10 and Weight 6 the best settings?
They are implementation defaults, not proven optimal settings. The coefficient behavior and complete trading rules must be evaluated for the intended data.
Does a buy event guarantee a trend reversal?
No. It records the line beginning to rise after it was not rising. It does not specify future price behavior, execution, position size, or exits.
Can I use it in a strategy?
Its outputs can define conditions, but a strategy also needs order timing, exits, sizing, and cost assumptions. Validate those rules independently of how the line looks.


