mirror of
https://github.com/mihakralj/QuanTAlib.git
synced 2026-08-13 08:08:05 +00:00
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.
28 lines
807 B
Plaintext
28 lines
807 B
Plaintext
// Licensed under the Apache License, Version 2.0
|
|
// © mihakralj
|
|
//@version=6
|
|
indicator("Square Root Transformation (SQRT)", "Sqrttrans", overlay=false)
|
|
|
|
//@function Applies a square root transformation (y = √x) to the input series.
|
|
//@param source series float The input series to transform. Must contain non-negative values.
|
|
//@returns series float The square root transformed series. Returns na if source < 0.
|
|
//@optimized for performance and dirty data
|
|
sqrtT(series float source) =>
|
|
if na(source)
|
|
na
|
|
else if source < 0
|
|
na
|
|
else
|
|
math.sqrt(source)
|
|
|
|
// ---------- Main loop ----------
|
|
|
|
// Inputs
|
|
i_source = input.source(close, "Source")
|
|
|
|
// Calculation
|
|
transformedSource = sqrtT(i_source)
|
|
|
|
// Plot
|
|
plot(transformedSource, "Sqrttrans", color=color.yellow, linewidth=2)
|