Files
Miha Kralj 35a6702b06 fix(docs): correct .md documentation across errors, dynamics, filters, forecasts, momentum, numerics, oscillators, reversals, statistics, trends, volatility, volume
Deep review of all indicator categories verified .md headers against .cs WarmupPeriod, parameters, inputs, and outputs. Fixes include warmup corrections, parameter documentation, output type accuracy, and Pine Script alignment.
2026-03-10 18:38:23 -07:00

30 lines
941 B
Plaintext

// Licensed under the Apache License, Version 2.0
// © mihakralj
//@version=6
indicator("Linear Scaling Transformer (LINEARTRANS)", "LINEARTRANS", overlay=true, precision=8)
//@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
// ---------- Main loop ----------
// Inputs
i_source = input.source(close, "Source")
i_slope = input.float(1.0, "Slope (a)")
i_intercept = input.float(0.0, "Intercept (b)")
// Calculation
result = lineartrans(i_source, i_slope, i_intercept)
// Plot
plot(result, "Lineartrans", color=color.yellow, linewidth=2)