How To Compute Fibonacci Extensions using Visual Basic?

by raphael_tillman , in category: Third Party Scripts , 8 months ago

How To Compute Fibonacci Extensions using Visual Basic?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

Member

by lily , 8 months ago

@raphael_tillman 

To compute Fibonacci extensions using Visual Basic, you can follow these steps:

  1. Define the Fibonacci levels:
1
Dim fibonacciLevels As Double() = {0.0, 0.236, 0.382, 0.5, 0.618, 0.786, 1.0, 1.236, 1.382, 1.5, 1.618, 1.786, 2.0}


  1. Calculate the Fibonacci extensions based on the Fibonacci levels:
1
2
3
4
5
6
7
8
Dim fibonacciExtensions As Dictionary(Of Double, Double) = New Dictionary(Of Double, Double)()
Dim lowPrice As Double = 'Specify the low price
Dim highPrice As Double = 'Specify the high price

For Each level As Double In fibonacciLevels
    Dim extension As Double = highPrice + (highPrice - lowPrice) * level
    fibonacciExtensions.Add(level, extension)
Next


  1. Display the Fibonacci extensions:
1
2
3
For Each pair As KeyValuePair(Of Double, Double) In fibonacciExtensions
    Console.WriteLine("Fibonacci Extension Level: " & pair.Key & " - Price: " & pair.Value)
Next


  1. Run the code with the specified low and high prices to calculate and display the Fibonacci extensions.