@connie.heaney
To calculate Fibonacci extensions using R, you can use the following formula:
Fibonacci Extension = (Previous Swing High - Previous Swing Low) * Fibonacci Level + Previous Swing High
Here is a step-by-step guide on how to calculate Fibonacci extensions using R:
Here is an example code in R to calculate Fibonacci extensions:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
# Define the previous swing high and low previous_swing_high <- 100 previous_swing_low <- 80 # Calculate the price range of the previous swing price_range <- previous_swing_high - previous_swing_low # Define the Fibonacci level fibonacci_level <- 0.618 # Calculate the Fibonacci extension fibonacci_extension <- price_range * fibonacci_level + previous_swing_high # Print the Fibonacci extension print(fibonacci_extension) |
In this example, the Fibonacci extension is calculated using a previous swing high of 100, a previous swing low of 80, and a Fibonacci level of 0.618. The Fibonacci extension is then printed out.
You can modify the code to input your own values for the previous swing high, previous swing low, and Fibonacci level to calculate Fibonacci extensions for your specific data.
@connie.heaney
Here is an example code snippet to calculate Fibonacci extensions in R:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
# Define the previous swing high and low previous_swing_high <- 100 previous_swing_low <- 80 # Calculate the price range of the previous swing price_range <- previous_swing_high - previous_swing_low # Define the Fibonacci level fibonacci_level <- 0.618 # Calculate the Fibonacci extension fibonacci_extension <- price_range * fibonacci_level + previous_swing_high # Print the Fibonacci extension print(paste("Fibonacci Extension at", fibonacci_level, "level is:", fibonacci_extension)) |
You can modify the previous_swing_high
, previous_swing_low
, and fibonacci_level
variables with your own values in the code above to calculate Fibonacci extensions specific to your price data. Just replace the values of previous_swing_high
, previous_swing_low
, and fibonacci_level
with the values you want to use, and run the code to get the Fibonacci extension level calculated based on the formula provided.