Advertisement
kocurekc

Pine Script - Fisher Transform with Up Down

May 5th, 2014
319
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.23 KB | None | 0 0
  1. study("Fisher and Cross")
  2. // Fisher Transform and Crosses, Rev 01
  3. // Junk Still - Working Copy
  4. // https://getsatisfaction.com/tradingview/topics/seeking_script_writer_to_enhance_a_current_indicator
  5. //
  6. // Rewrite for Tradingview "Pine Script" by Kocurekc, April 2014
  7. // https://getsatisfaction.com/tradingview/
  8. // https://www.tradingview.com/u/kocurekc/
  9. // Code is provided as public domain, no warranty
  10.  
  11. LB = input(title="Lookback Period", type=integer, defval=31, minval=2)
  12. //SO = input(title="Signal Offset Factor", type=float, defval=0.20, minval=0.01)
  13. IT = input(title="Input Threshold", type=float, defval=1.50, minval=0.01)
  14.  
  15. Value1 = (0.33*2)*((hl2 - lowest(low, LB))/(highest(high, LB) - lowest(low, LB)) - 0.5) + 0.6667*(nz(Value1[1]))
  16. Value2 = Value1 > 0.99 ? 0.999 : Value1 < -0.99 ? -0.999 : Value1
  17. Fisher = 0.5 * log((1+Value2)/(1-Value2)) + 0.5 * nz(Fisher[1])
  18. Trigger = nz(Fisher[1])
  19.  
  20. plot(Fisher, style=histogram, color=red)
  21. plot(Trigger, color=black)
  22.  
  23. trendDown = Fisher < Fisher[1] ? Fisher[1] > Fisher[2] ? Fisher[1] >= IT ? -1 : 0 : 0 : 0
  24. trendUp = Fisher > Fisher[1] ? Fisher[1] < Fisher[2] ? Fisher[1] <= -IT ? 1 : 0 : 0 : 0
  25.  
  26. plot(trendUp, style=columns, color=green)
  27. plot(trendDown, style=columns, color=red)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement