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 #

Chande's Vidya Using P Variable - Version I
Here is a version of Vidya using a P variable that matches MetaStock's built-in
Variable Moving Average. You can overlay them in different colours on the same chart to satisfy yourself that they are indeed the same (but remember to use the same number of periods). There is a small difference at the start due to different initialisation, after which they are identical. The coding is spelled out for the benefit of anyone studying the book. It can be adapted by adding a variable input for the CMO length (9), or made universal by replacing each C with a P, or the Abs(CMOsc) can be replaced with a different volatility index that ranges between 0 and 1.

from HHP


Chande's Vidya Using P Variable - Version I

Pds:= Input("Number of Periods?",1,1000,20);
Alpha:= 2/(Pds+1);
{Chande Momentum Oscillator}
{UD = Up day}
{DD = Down day}
UD:= Sum((C-Ref(C,-1))*(C>Ref(C,-1)),9);
DD:= Sum((Ref(C,-1)-C)*(C<Ref(C,-1)),9);
CMOsc:= (UD-DD)/(UD+DD);
k:= Abs(CMOsc);
Vidya:= (Cum(1) < Pds) * C +
(Cum(1)>=Pds) * ((Alpha * k * C) + (1-Alpha * k) * PREV);
Vidya

 

e-w-Chande_Vidya_Using_P_Variable_Version_1.gif
Source / From: TOP
http://www.guppytraders.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!