feat: add new indicators (Decay, Edecay, MinusDi, MinusDm, PlusDi, PlusDm, Maxindex, Minindex, Sarext) and update pine scripts, core libs, validation tests, and python bindings
2026-03-09 13:45:46 -07:00
|
|
|
// Licensed under the Apache License, Version 2.0
|
2026-01-18 19:02:03 -08:00
|
|
|
// © mihakralj
|
|
|
|
|
//@version=6
|
fix(docs): correct .md documentation across errors, dynamics, filters, forecasts, momentum, numerics, oscillators, reversals, statistics, trends, volatility, volume
2026-03-10 18:38:23 -07:00
|
|
|
indicator("Linear Scaling Transformer (LINEARTRANS)", "LINEARTRANS", overlay=true, precision=8)
|
2026-01-18 19:02:03 -08:00
|
|
|
|
fix(docs): correct .md documentation across errors, dynamics, filters, forecasts, momentum, numerics, oscillators, reversals, statistics, trends, volatility, volume
2026-03-10 18:38:23 -07:00
|
|
|
//@function Applies a simple affine (linear) transformation: y = slope * x + intercept
|
|
|
|
|
//@param src Source series to transform
|
|
|
|
|
//@param a Slope (scaling factor). Default 1.0.
|
|
|
|
|
//@param b Intercept (offset). Default 0.0.
|
|
|
|
|
//@returns Linearly transformed value: a * src + b
|
|
|
|
|
//@optimized Single FMA operation per bar — O(1) with zero allocations.
|
|
|
|
|
lineartrans(series float src, float a, float b) =>
|
|
|
|
|
if na(src)
|
|
|
|
|
na
|
|
|
|
|
else
|
|
|
|
|
a * src + b
|
2026-01-18 19:02:03 -08:00
|
|
|
|
|
|
|
|
// ---------- Main loop ----------
|
|
|
|
|
|
|
|
|
|
// Inputs
|
fix(docs): correct .md documentation across errors, dynamics, filters, forecasts, momentum, numerics, oscillators, reversals, statistics, trends, volatility, volume
2026-03-10 18:38:23 -07:00
|
|
|
i_source = input.source(close, "Source")
|
|
|
|
|
i_slope = input.float(1.0, "Slope (a)")
|
|
|
|
|
i_intercept = input.float(0.0, "Intercept (b)")
|
2026-01-18 19:02:03 -08:00
|
|
|
|
|
|
|
|
// Calculation
|
fix(docs): correct .md documentation across errors, dynamics, filters, forecasts, momentum, numerics, oscillators, reversals, statistics, trends, volatility, volume
2026-03-10 18:38:23 -07:00
|
|
|
result = lineartrans(i_source, i_slope, i_intercept)
|
2026-01-18 19:02:03 -08:00
|
|
|
|
|
|
|
|
// Plot
|
fix(docs): correct .md documentation across errors, dynamics, filters, forecasts, momentum, numerics, oscillators, reversals, statistics, trends, volatility, volume
2026-03-10 18:38:23 -07:00
|
|
|
plot(result, "Lineartrans", color=color.yellow, linewidth=2)
|