RicardoSantos

Nth Fibonacci Number

140 0 11
Binet's Formula to find Nth Fibonacci Number.
Remove from Favorite Scripts Add to Favorite Scripts
//@version=2
study("Nth Fibonacci Number")
//-----------------
//Binet's Formula to solve the Nth Fibonacci Number
f_n_fib(_step) =>
    _phi = 1.618
    _n_phi = 1/_phi
    _return = round(_step >= 0 ? pow(_phi, _step) / sqrt(5) : pow(-_n_phi, _step) / sqrt(5))
//-----------------
step = na(step[1]) ? 1 : n >= f_n_fib(step[1]) ? step[1]+1 : step[1]
current_fib = f_n_fib(step)
plot(title='Fib Time Number', series=current_fib, color=black)
United States
United Kingdom
India
Deutschland
France
España
Italia
Polska
Türkiye
Россия
Brasil
Indonesia
Malaysia
ประเทศไทย
Việt Nam
日本
한국
简体
繁體
Home Stock Screener Forex Signal Finder Cryptocurrency Signal Finder Economic Calendar How It Works Chart Features House Rules Moderators Website & Broker Solutions Widgets Stock Charting Library Feature Request Blog & News FAQ Help & Wiki Twitter
Profile Profile Settings Account and Billing My Support Tickets Priority Support Contact Support Ideas Published Followers Following Private Messages Chat Sign Out