MetaStock™ Zone Forum & FAQ Artykuły Linki Elliott Waves EasyLanguage™ Zone

A B C D E F G H I J K L M N O P R S T U V W Y Z #

Spread & Volatility by Mark Conway and Aaron Behle
In "Daytrading Stock Pairs" in this issue, Mark Conway and Aaron Behle discuss
volatility bands and spread values. These indicators can be easily recreated in MetaStock. To create an indicator in MetaStock, select "Indicator Builder" from the Tools menu, click "New," enter the code for the indicator, and then click OK. The following code is for MetaStock Professional 7.0.

Spread & Volatility

hv1:=Input("30 day historical volatility of first security",0,100,0.5);
hv2:=Input("30 day historical volatility of second security",0,100,0.5);
r:=Input("correlation coefficient of these securities",0,100,0.5);
vf:=Input("volatility factor",0,5,1.5);
p1:= Security("ATVI", C );
p2:= Security("THQI", C );

{For MetaStock 6.52 or end-of-day users, change the above two lines to: p1:= p;
p2:= C;

This version is more readily adaptable to any security pair, but it requires more care in plotting it. The modified version requires you to insert the prices of the one security into the chart of the other. Then you must plot this indicator on the prices you just inserted.) To continue with the code: }

newday:=ROC(DayOfWeek(),1,$)<>0;
yp1:=ValueWhen(1,newday, Ref(p1,-1));
yp2:=ValueWhen(1,newday, Ref(p2,-1));
sprd:= (p1/yp1) - (p2/yp2);
vb:=(hv1 + hv2) * Power(1/252,0.5) * (1-r);
sprd;
vb*vf;
Neg(vb*vf)

 

To plot the indicator, locate it in MetaStock's Indicator Quicklist, then click and drag it onto the desired chart. --William Golson, Equis International
www.equis.com
Source / From: TOP
http://www.traders.com

Equis and MetaStock® and MetaStock Professional® are registered trademarks of Equis International. Achelis Binary Wave®, The DownLoader®,
Expert Advisor®, OptionScope®, Quotecenter® and Smart Charts® are trademarks of Equis International, a Thomson Reuters company.

TradeStation® Pro, TradeStation® 2000i, OptionStation®, SuperCharts®, PowerEditor® and EasyLanguage®
are registered trademarks of TradeStation Technologies, Inc. Other names and marks referred to are the property of their respective owners.

All information provided on this website is for educational purposes only. Trading involves risk, including possible loss of principal and other losses.

Ten i inne materiały na tej stronie zostały zamieszczone zostały jedynie w celach edukacyjnych, nie ponoszę żadnej odpowiedzialno¶ci za ich stosowanie.

Gra na giełdzie i rynkach walutowych (FOREX) niesie ze sob± ryzyko poważnych strat finansowych!