reees

Fibonacci

reees Updated   
Library "Fibonacci"
General Fibonacci functions. Get fib numbers, ratios, etc.

fib_precise(f, precision)
  Get the precise Fibonacci ratio, to the specified number of decimal places
  Parameters:
    f: Fibonacci ratio (string, in form #.###)
    precision: Number of decimal places (optional int, dft = 16, max = 32)
  Returns: Precise Fibonacci ratio (float)

fib_n(n)
  Calculate the Nth number in the Fibonacci sequence
  Parameters:
    n: Index/number in sequence (int)
  Returns: Fibonacci number (int)
Release Notes:
v2
Added "fib" 1.414
Release Notes:
v3

Added:
fib_from_string(r)
  Get fib ratio value from string
  Parameters:
    r: Fib ratio string (e.g. ".618")
  Returns: Fibonacci ratio value (float)
Release Notes:
v4
Hard-coded precise fibs for efficiency (rather than deriving them)

Added:
fib_derived(f, precision)
  Get the precise Fibonacci ratio, to the specified number of decimal places
  Parameters:
    f: Fibonacci ratio (string, in form #.###)
    precision: Number of decimal places (optional int, dft = 16, max = 32)
  Returns: Precise Fibonacci ratio (float)
* Deprecated (use fib_precise() instead), but keeping it here for science / experimenting with derivations

Pine library

In true TradingView spirit, the author has published this Pine code as an open-source library so that other Pine programmers from our community can reuse it. Cheers to the author! You may use this library privately or in other open-source publications, but reuse of this code in a publication is governed by House Rules.

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.

Want to use this library?

Copy the following line and paste it in your script.