mirror of
https://github.com/mihakralj/QuanTAlib.git
synced 2026-08-08 14:07:44 +00:00
24e86d762a
- Updated BBWN, BBWP, CCV, CV, CVI, EWMA, GKV, HLV, HV, Jvolty, JVOLTYN, MASSI, NATR, RSV, RV, RVI, TR, UI, VOV, VR, YZV indicators with documentation links. - Added documentation links for Aberration, Acceleration Bands, Andrews' Pitchfork, Adaptive Price Zone, ATR Bands, Bollinger Bands, Center of Gravity, Donchian Channels, Decay Min-Max Channel, Detrended Synthetic Price, EACP, EBSW, HOMOD, Jurik Volatility Bands, Keltner Channel, MA Envelope, Min-Max Channel, Price Channel, Regression Channels, Standard Deviation Channel, Stoller Average Range Channel, Super Trend Bands, Ultimate Bands, Ultimate Channel, VWAP Bands, and VWAP with Standard Deviation Bands.
28 lines
851 B
Plaintext
28 lines
851 B
Plaintext
// The MIT License (MIT)
|
|
// © 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)
|
|
runtime.error("Parameter 'source' cannot be na.")
|
|
if source <= 0
|
|
na
|
|
else
|
|
math.log(source)
|
|
|
|
// ---------- Main loop ----------
|
|
|
|
// Inputs
|
|
i_source = input(close, "Source")
|
|
|
|
// Calculation
|
|
transformedSource = logT(i_source)
|
|
|
|
// Plot
|
|
plot(transformedSource, "Log Transformation", color=color.green, color=color.yellow, linewidth=2)
|