Library "RiskTools"
Provides functions for calculating risk metrics
pctDrop(start, result)
Calculates what is the percentage drop from a reference price
Parameters:
start (float): Starting price before the drop occurred
result (float): Resulting price to which the percentage drop occurred
Returns: Percentage drop from "start" to "result"
priceBeforeDrop(pctDrop, result)
Calculates a starting price given a resulting price and a percentage drop to that price
Parameters:
pctDrop (float): Percentage drop
result (float): Resulting price to which the percentage drop occurred
Returns: The starting price from which a percentage drop "pctDrop" gave a "result"
dropzone(price, masource, malength, window, zonesize)
Calculates drop zone as an integer representing some multiple of the "zoning size"
Parameters:
price (float): The current price from which you want to calculate the drop zone
masource (float): The source series used in the SMA calculation from which the floor price is determined
malength (simple int): The length used in the SMA calculation from which the floor price is determined
window (simple int): The lookback period from which to calculate the floor price
zonesize (simple int)
Returns: The zone identifier as a multiple of the zone size. A value of zero or less is translated to the first zone.