Ehler's Fisher Transform
stableDescription
Based on the original Ehler's article on Fisher Transform: https://www.mesasoftware.com/papers/UsingTheFisherTransform.pdf
This filter is used to predict the trend turning points.
The code uses Pshai's CC_IndicatorMemory. I would like to thank Pshai for helping me with the debugging.
Usage:
local per = Input('Period', 20, 'Fisher transform period')
local fisherTF = Input('TF for Fisher transform', 1)
OptimizedForInterval(
fisherTF,
function()
local src = HLPrices(fisherTF)
local fisher = CC_FISHER(src, 20)
Plot(1, 'fisher', fisher)
end
)
HaasScript
DefineCommand('FISHER', 'Fisher Transform')
local src = DefineParameter(ListNumberType, 'source', 'Data source to transform', true, HLPrices())
local per = DefineParameter(NumberType, 'period', 'Fisher Transform period', true, 20)
local fish = CC_IndicatorMemory(
function(j, mem)
local s = CC_IndicatorMemory(
function(i, mem)
local highest = GetHigh(src[i], per)
local lowest = GetLow(src[i], per)
local prevValue = mem[1] or 0
local value = .33*2*(ArrayGet( ((src - lowest) / (highest - lowest) - .5), 1)) + .67*prevValue
if value > .99 then
value = .999
end
if value < -.99 then
value = -.999
end
return value
end)
local prevFisher = mem[1] or 0
local fisher = .5*Ln((1 + s[j])/(1 - s[j])) + .5*prevFisher
return ArrayGet(fisher, 1)
end)
DefineOutput(ListNumberType, fish)
0 Comments
Sign in to leave a comment.
No comments yet. Be the first!