PINE LIBRARY
Updated VolTargeting

Library "VolTargeting"
ewmaVol(estimationWdw)
Calculates an exponentially weighted annualised volatility
Parameters:
estimationWdw (simple int): Half life of exponential weighting scheme
Returns: Exponentially weighted annualised volatility
volTargettedSize(nominalBalance, targetVolContribution, forecastVol)
Calculates a volatility-targetted position size in number of units
Parameters:
nominalBalance (float): Portfolio size on which to calculate volatility targets
targetVolContribution (float): Amount of volatility to be assigned to this position
forecastVol (float): Volatility forecast to use in position size calculation as %
Returns: Position size in units (shares, contracts, etc)
ewmaVol(estimationWdw)
Calculates an exponentially weighted annualised volatility
Parameters:
estimationWdw (simple int): Half life of exponential weighting scheme
Returns: Exponentially weighted annualised volatility
volTargettedSize(nominalBalance, targetVolContribution, forecastVol)
Calculates a volatility-targetted position size in number of units
Parameters:
nominalBalance (float): Portfolio size on which to calculate volatility targets
targetVolContribution (float): Amount of volatility to be assigned to this position
forecastVol (float): Volatility forecast to use in position size calculation as %
Returns: Position size in units (shares, contracts, etc)
Release Notes
v2Fixed spelling
Pine library
In true TradingView spirit, the author has published this Pine code as an open-source library so that other Pine programmers from our community can reuse it. Cheers to the author! You may use this library privately or in other open-source publications, but reuse of this code in publications is governed by House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.
Pine library
In true TradingView spirit, the author has published this Pine code as an open-source library so that other Pine programmers from our community can reuse it. Cheers to the author! You may use this library privately or in other open-source publications, but reuse of this code in publications is governed by House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.