-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathGet-FibonacciRetracement.ps1
More file actions
37 lines (30 loc) · 1.29 KB
/
Get-FibonacciRetracement.ps1
File metadata and controls
37 lines (30 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<#
.SYNOPSIS
Calculate Fibonacci retracement levels based on the provided StartPrice and EndPrice.
.DESCRIPTION
This function calculates Fibonacci retracement levels for a given price range.
.PARAMETER StartPrice
The starting price for the Fibonacci retracement calculation.
.PARAMETER EndPrice
The ending price for the Fibonacci retracement calculation.
.EXAMPLE
The following example demonstrates how to use the function:
Get-FibonacciRetracement -StartPrice 100 -EndPrice 200
#>
function Get-FibonacciRetracement {
[CmdletBinding()]
param(
[Parameter(Mandatory = $true)]
[double]$StartPrice,
[Parameter(Mandatory = $true)]
[double]$EndPrice
)
# Fibonacci retracement levels calculation
$retracementLevels = @()
$retracementLevels += ($EndPrice - ($EndPrice - $StartPrice) * 0.236) # 23.6% retracement level
$retracementLevels += ($EndPrice - ($EndPrice - $StartPrice) * 0.382) # 38.2% retracement level
$retracementLevels += ($EndPrice - ($EndPrice - $StartPrice) * 0.5) # 50% retracement level
$retracementLevels += ($EndPrice - ($EndPrice - $StartPrice) * 0.618) # 61.8% retracement level
$retracementLevels += ($EndPrice - ($EndPrice - $StartPrice) * 0.786) # 78.6% retracement level
return $retracementLevels
}