How To Calculate Fibonacci Retracements in VB.NET?

Member

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

How To Calculate Fibonacci Retracements in VB.NET?

Facebook Twitter LinkedIn Whatsapp

1 answer

Member

by coleman , a month ago

@morton 

To calculate Fibonacci retracements in VB.NET, you can use the following formula:

  1. Determine the highest point (A) and lowest point (B) of the price movement you want to analyze.
  2. Calculate the difference between point A and point B. This is the total price movement.
  3. Calculate the Fibonacci retracement levels by multiplying the total price movement by the following ratios:
  • 23.6% = total movement * 0.236
  • 38.2% = total movement * 0.382
  • 61.8% = total movement * 0.618
  1. Add or subtract the calculated retracement levels from point A to get the Fibonacci retracement levels.


Here is an example code snippet in VB.NET for calculating Fibonacci retracements:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
Dim highestPoint As Double = 100
Dim lowestPoint As Double = 50
Dim totalMovement As Double = highestPoint - lowestPoint

Dim fib236 As Double = totalMovement * 0.236
Dim fib382 As Double = totalMovement * 0.382
Dim fib618 As Double = totalMovement * 0.618

Dim fib236Retracement As Double = highestPoint - fib236
Dim fib382Retracement As Double = highestPoint - fib382
Dim fib618Retracement As Double = highestPoint - fib618

Console.WriteLine("23.6% Fibonacci Retracement Level: " & fib236Retracement)
Console.WriteLine("38.2% Fibonacci Retracement Level: " & fib382Retracement)
Console.WriteLine("61.8% Fibonacci Retracement Level: " & fib618Retracement)


You can customize the code above by inputting your own highest and lowest points and adjust the Fibonacci ratios as needed.