Historical Volatility Ratio

Historical volatility is a measure of volatility over a fixed span of time. The Historical Volatility Ratio divides the calculation for what is usually a short span of time by the same calculations for a usually longer span of time.

Historical volatility is calculated by taking the standard deviation of the natural log of the ratio of consecutive closing prices over time.  This is multiplied by the square root of the number of bars in a year so it can be compared to other time spans and multiplied by 100 to convert it to a percentage.

You can ignore the two multiplication steps when calculating the ratio because these values will cancel out.

Custom PCF Formula
SQR(ABS((SUM(LOG(C / C1) ^ 2, n) - LOG(C / Cn) ^ 2 / n) / n)) / SQR(ABS((SUM(LOG(C / C1) ^ 2, d) - LOG(C / Cd) ^ 2 / d) / d))
n=NumeratorPeriod, d=DenominatorPeriod

Where n is the first period specified for the historical volatility in the numerator which must be an integer.
Where d is the second period specified for the historical volatility in the denominator which must be an integer.

Unlike the raw historical volatilities used in its calculation, the historical volatility ratio will be correct in all time frames as long as you are interested in periods based on a number of bars and not on a span of time. 

Examples

The Historical Volatility Ratio 6 / 100 can be written as follows.

SQR(ABS((SUM(LOG(C / C1) ^ 2, 6) - LOG(C / C6) ^ 2 / 6) / 6)) / SQR(ABS((SUM(LOG(C / C1) ^ 2, 100) - LOG(C / C100) ^ 2 / 100) / 100))

The Historical Volatility Ratio 10 / 50 can be written as follows.

SQR(ABS((SUM(LOG(C / C1) ^ 2, 10) - LOG(C / C10) ^ 2 / 10) / 10)) / SQR(ABS((SUM(LOG(C / C1) ^ 2, 50) - LOG(C / C50) ^ 2 / 50) / 50))