|
|
MetaStock code for Volatility Ratio
Last post 07-17-2007, 20:00 by oztrader. 9 replies.
-
07-13-2007, 18:27 |
-
oztrader
-
-

-
Joined on 07-13-2007
-
Perth Western Australia
-
Posts 35
-
-
|
MetaStock code for Volatility Ratio
Is anyone aware if Jack Schwager's Volatility Ratio has been coded for MetaStock.
|
|
-
07-13-2007, 23:10 |
-
minnamor
-
-

-
Joined on 04-27-2005
-
Italy
-
Posts 110
-
-
|
Re: MetaStock code for Volatility Ratio
I have got this formula for volatlity ratio as used by Connors and Ratscke:
VR:=Std(Log(C/Ref(C,-1)),5)/Std(Log(C/Ref(C,-1)),99);
Do not know if it is what you are looking for.
|
|
-
07-14-2007, 21:55 |
-
oztrader
-
-

-
Joined on 07-13-2007
-
Perth Western Australia
-
Posts 35
-
-
|
Re: MetaStock code for Volatility Ratio
Hi minnamor,
Thanks for your response, however the code looks significantly different from what i would expect.
Perhaps I should have included the following details in my initial post (my 1st attempt so please forgive me):-
VR = True Range / True Range for the past "n" periods.
Whilst "True Range" is part of the calculation of ATR, I believe there is a difference between the two.
Regards,
oztrader
|
|
-
07-15-2007, 20:14 |
-
wabbit
-
-

-
Joined on 10-28-2004
-
Perth, Western Australia
-
Posts 1,603
-
-
|
Re: MetaStock code for Volatility Ratio
oztrader, There are many different ways to achieve what you think you mean, unfortunately as you have not fully defined what you think you mean to us, so I will have a guess and provide a few possible solutions. First, True Range can be defined using the built in MS indicator: or, you can define your own using: |
r1:=H-L; r2:=Abs(Ref(C,-1)-H); r3:=Abs(Ref(C,-1)-L);
TrueRange:=Max(Max(r1,r2),r3);
{plot/return} TrueRange; |
Now we have the TrueRange defined (the numerator) we can try to define what you mean in your denominator term "True Range for the past "n" periods." You might try: |
n:=10; myVolatility:=ATR(1)/ATR(n);
{plot/return} myVolatility; |
or, maybe: |
n:=10; myVolatility:=ATR(1)/Sum(ATR(1),n);
{plot/return} myVolatility; |
or, what about: |
n:=10; myVolatility:=ATR(1)/HHV(ATR(1),n);
{plot/return} myVolatility; |
or, even: |
n:=10; zero:=Power(10,-30);
myVolatility:=(ATR(1)-LLV(ATR(1),n))/Max(HHV(ATR(1),n)-LLV(ATR(1),n),zero);
{plot/return} myVolatility; |
Remember, you have to define EXACTLY what you think you mean so that it can be correctly programmed, but I hope one of these might help... wabbit
MS: 6.52 EOD, 7.x EOD, 8.0 PRO, 9.2 PRO w/QC, 10 PRO w/QC & MDK For custom MetaStock programming : http://www.wabbit.com.au My SkyPE status :  My SkyPE account : wabbit.com.au
|
|
-
07-16-2007, 3:42 |
-
wabbit
-
-

-
Joined on 10-28-2004
-
Perth, Western Australia
-
Posts 1,603
-
-
|
Re: MetaStock code for Volatility Ratio
oztrader, Following our phone conversation today I did a liitle more reading about Schwager, and although I did not find any exact definitions of his code, I did manage to glean this code by combining several different "descriptions" of his volatiliy ratio: |
{Volatility Ratio - Schwager}
n:=Input("Periods",1,253,14); zero:=Power(10,-10);
r1:=H-L; r2:=Abs(H-Ref(C,-1)); r3:=Abs(Ref(C,-1)-L);
TrueRange:=Max(Max(r1,r2),r3);
TrueHighPds:=Max(HHV(H,n),Ref(C,-n)); TrueLowPds:=Min(LLV(L,n),Ref(C,-n)); TrueRangePds:=TrueHighPds-TrueLowPds;
VolatilityRatio:=TrueRange/Max(TrueRangePds,zero);
{plot VR} VolatilityRatio; |
Hope this helps. wabbit ![Big Smile [:D]](/emoticons/emotion-2.gif) [edited: following even more discussions...]
MS: 6.52 EOD, 7.x EOD, 8.0 PRO, 9.2 PRO w/QC, 10 PRO w/QC & MDK For custom MetaStock programming : http://www.wabbit.com.au My SkyPE status :  My SkyPE account : wabbit.com.au
|
|
-
07-17-2007, 2:52 |
-
amory
-
-

-
Joined on 04-19-2007
-
sydney australia
-
Posts 99
-
-
|
Re: MetaStock code for Volatility Ratio
an interesting formula Wabbit, but I don't see where it is of any use projected onto a chart. like most volatility-type indicators (the ATR & the RVI as well as Chaikin's vol) it is very hard to draw any conclusions as to the stock involved. but this one even more so, I mean it tells me nothing!
my favorite in this class of indicators would have to be the CBOE, known as ^VIX, as long as you remember to read it upside-down. but I don't think that one is designed for general use.
amory
|
|
-
07-17-2007, 4:54 |
-
oztrader
-
-

-
Joined on 07-13-2007
-
Perth Western Australia
-
Posts 35
-
-
|
Re: MetaStock code for Volatility Ratio
Hi Wabbit,
I take on board your comment re "what am I really requesting in this code" and it has been a enlightening journey working thru the alternatives.
Your latest posting covers what I was chasing and as such I thankyou for your assistance and patience.
Regards,
oztrader
|
|
-
07-17-2007, 5:09 |
-
oztrader
-
-

-
Joined on 07-13-2007
-
Perth Western Australia
-
Posts 35
-
-
|
Re: MetaStock code for Volatility Ratio
Hi amory,
Although this question has been directed to Wabbit and he may well respond, I am interested in a variety of volatility codes to test in mechanical systems, either mutually or exclusively, and I have an affinity to indicators related to the ATR. From Wabbit's viewpoint I may well be a lost sole looking for a dense forest to fulfil my destiny.
Cheers,
oztrader
|
|
-
07-17-2007, 5:28 |
-
wabbit
-
-

-
Joined on 10-28-2004
-
Perth, Western Australia
-
Posts 1,603
-
-
|
Re: MetaStock code for Volatility Ratio
amory, Although this indicator might not be of use on its own; like many of the volatility indicators, this function can be employed to do "other jobs" like adjust the length of a moving average, RSI or other indicators etc. This code produces values between zero and one, so we might multiply this result by a factor then create a variable moving average that is shorter in periods of low "volatility" and longer in high "volatility". Obviously, we can reverse this if we like. Hope this helps. wabbit
MS: 6.52 EOD, 7.x EOD, 8.0 PRO, 9.2 PRO w/QC, 10 PRO w/QC & MDK For custom MetaStock programming : http://www.wabbit.com.au My SkyPE status :  My SkyPE account : wabbit.com.au
|
|
-
07-17-2007, 20:00 |
-
oztrader
-
-

-
Joined on 07-13-2007
-
Perth Western Australia
-
Posts 35
-
-
|
Re: MetaStock code for Volatility Ratio
Hi Amory,
I appologise for being somewhat flippant in my reply last night.
The Volatility Ratio has been used to identify "Wide-Ranging Days" when used in association with Trend Reversal (refer to incrediblecharts.com).
Regards,
oztrader
|
|
|
|