mirror of
https://github.com/mihakralj/QuanTAlib.git
synced 2026-07-31 02:47:44 +00:00
35a6702b06
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
812 B
Plaintext
28 lines
812 B
Plaintext
// Licensed under the Apache License, Version 2.0
|
|
// © mihakralj
|
|
//@version=6
|
|
indicator("Logarithmic Transformation (LOG)", "Logtrans", overlay=false)
|
|
|
|
//@function Applies a natural logarithmic transformation (y = ln(x)) to the input series.
|
|
//@param source series float The input series to transform. Must contain positive values.
|
|
//@returns series float The logarithmically transformed series. Returns na if source <= 0.
|
|
//@optimized for performance and dirty data
|
|
logT(series float source) =>
|
|
if na(source)
|
|
na
|
|
else if source <= 0
|
|
na
|
|
else
|
|
math.log(source)
|
|
|
|
// ---------- Main loop ----------
|
|
|
|
// Inputs
|
|
i_source = input.source(close, "Source")
|
|
|
|
// Calculation
|
|
transformedSource = logT(i_source)
|
|
|
|
// Plot
|
|
plot(transformedSource, "Logtrans", color=color.yellow, linewidth=2)
|