How To Calculate Fibonacci Extensions in VB.NET?

Member

by conor , in category: Technical Analysis , 2 months ago

How To Calculate Fibonacci Extensions in VB.NET?

Facebook Twitter LinkedIn Whatsapp

1 answer

Member

by annalise , a month ago

@conor 

To calculate Fibonacci extensions in VB.NET, you can use the following code:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
Public Class FibonacciExtensionsCalculator

    Public Function CalculateFibonacciExtension(n As Integer) As Integer
        If n = 0 Then
            Return 0
        ElseIf n = 1 Then
            Return 1
        Else
            Return CalculateFibonacciExtension(n - 1) + CalculateFibonacciExtension(n - 2)
        End If
    End Function

End Class


You can then call the CalculateFibonacciExtension function with the desired Fibonacci sequence number to get the corresponding Fibonacci extension. For example:

1
2
3
4
Dim calculator As New FibonacciExtensionsCalculator()
Dim fibonacciExtension As Integer = calculator.CalculateFibonacciExtension(5)

Console.WriteLine("Fibonacci extension at position 5 is: " & fibonacciExtension)


This code will calculate the Fibonacci extension at position 5, which in this case is 5. You can adjust the input number to calculate the Fibonacci extension at any other position.