mirror of
https://github.com/mihakralj/QuanTAlib.git
synced 2026-08-18 02:28:05 +00:00
- 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.
50 lines
1.6 KiB
Plaintext
50 lines
1.6 KiB
Plaintext
// The MIT License (MIT)
|
|
// © mihakralj
|
|
//@version=6
|
|
indicator("Fisher Transform", "FISHER", overlay=false)
|
|
|
|
//@function Calculates the Fisher Transform oscillator
|
|
//@param source Source price (typically hl2)
|
|
//@param period Lookback period for min/max normalization
|
|
//@returns [fisher, signal] Fisher Transform value and signal line
|
|
fisher(series float source, simple int period) =>
|
|
if period <= 0
|
|
runtime.error("Period must be greater than 0")
|
|
if period > 500
|
|
runtime.error("Period exceeds maximum of 500")
|
|
|
|
var float value = 0.0
|
|
var float fisher = 0.0
|
|
var float signal = 0.0
|
|
|
|
float highest = ta.highest(source, period)
|
|
float lowest = ta.lowest(source, period)
|
|
|
|
float price_range = highest - lowest
|
|
float normalized = price_range > 0 ? (source - lowest) / price_range : 0.5
|
|
normalized := 2.0 * normalized - 1.0
|
|
|
|
float alpha = 0.33
|
|
value := alpha * normalized + (1.0 - alpha) * value
|
|
|
|
value := math.max(-0.999, math.min(0.999, value))
|
|
|
|
fisher := 0.5 * math.log((1.0 + value) / (1.0 - value))
|
|
|
|
signal := alpha * fisher + (1.0 - alpha) * signal
|
|
|
|
[fisher, signal]
|
|
|
|
// ---------- Main loop ----------
|
|
|
|
i_period = input.int(10, "Period", minval=1, maxval=500)
|
|
i_source = input.source(hl2, "Source")
|
|
|
|
[fisher_line, signal_line] = fisher(i_source, i_period)
|
|
|
|
plot(fisher_line, "Fisher", color=color.yellow, linewidth=2)
|
|
plot(signal_line, "Signal", color=color.orange, linewidth=1)
|
|
hline(0, "Zero", color=color.gray, linestyle=hline.style_dotted)
|
|
hline(2, "Overbought", color=color.red, linestyle=hline.style_dashed)
|
|
hline(-2, "Oversold", color=color.green, linestyle=hline.style_dashed)
|