TheLark

TradingView Indicator: POLARIZED FRACTAL EFFICIENCY

May 21st, 2014
581
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. study(title="TheLark: Polarized Fractal Efficiency", shorttitle="Lark: PFE", overlay=false)
  2.  
  3. //•/•/•/•/•/•/•/•/•/•/•/•/•/•/•/•/•/•/•/•/•/•/•//
  4. // //
  5. // POLARIZED FRACTAL EFFICIENCY BY THELARK //
  6. // ~ 5-21-14 ~ //
  7. // //
  8. // •/• //
  9. // //
  10. // https://www.tradingview.com/u/TheLark //
  11. // //
  12. //•/•/•/•/•/•/•/•/•/•/•/•/•/•/•/•/•/•/•/•/•/•/•//
  13.  
  14. // PFE was developed by Hans Hannula that was invented to determine price efficiency over a user-defined time period.
  15.  
  16. // The Polarized Fractal Efficiency indicator is, in the essence, an exponentially smoothed ratio of the length of
  17. // two lines: (1) of a straight line between today’s close and the close Period days ago, and
  18. // (2) of a broken line connecting all Close points between today and Period days ago. The indicator output
  19. // varies between -100 and 100. The theory behind this indicator is that if it is >50 (or <-50) then the market is
  20. // likely to reverse its trend from positive to negative (or from negative to positive).
  21.  
  22. // Other useage:
  23. // Securities with a PFE greater than zero are deemed to be trending up, while a reading of less
  24. // than zero indicates the trend is down.
  25. // The strengh of the trend is measured by the position of the PFE relative to the zero line.
  26. // As a general rule, the further the PFE value is away from zero, the stronger and more efficient
  27. // the given trend is. A PFE value that fluctuates around the zero line could indicate that the supply
  28. // and demand for the security are in balance and price may trade sideways.
  29.  
  30. Length = input(10)
  31. Smoothing = input(5)
  32. SingleColor = input(false, title="Single Color?")
  33.  
  34. // Calcs
  35. ln = Length - 1
  36. diff = close - close[ln]
  37. pfetmp = 100 * sqrt(pow(diff,2) + pow(Length,2)) / sum(sqrt(1 + pow(close - close[1],2)), Length - 1)
  38. pfe = ema( diff > 0 ? pfetmp : -pfetmp, Smoothing)
  39.  
  40. // Plots
  41. col = SingleColor ? #FFD9CF : pfe > 50 or pfe < -50 ? #FF8D6F : #FFD9CF
  42. plot(pfe, color=col,linewidth=1)
  43.  
  44. hline(50, color=#FFD105, linestyle=dotted)
  45. hline(-50, color=#FFD105, linestyle=dotted)
  46. hline(0, color=#FFD105, linestyle=dotted)
RAW Paste Data