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 #

UpDown Oscillator by Jose Silva

The oscillator below measures a Up/Down bar count against an unchanged bar count.
It doesn't use any smoothing so there are no lag effects, and its overBought/Sold signals are quite good in sideways markets.

Like most price-based overBought/Sold oscillators, the UpDown osc doesn't like strong trends, so use only when the underlying market trend is weak.

MetaStock -> Tools -> Indicator Builder -> New -> copy & paste complete formula:


UpDown Oscillator

{ Up/Down bar Oscillator v2.0

Measures Up/Down bar count
against unchanged bar count.
Incorporating automatic overBought/Sold levels.
Trade at own risk.

©Copyright 2005-2007 Jose Silva.
The grant of this license is for personal use
only - no resale or repackaging allowed.
http://www.metastocktools.com }

{ Indicator Inputs }
pds:=Input("Lookback periods",1,2600,10);
plot:=Input("[1]UpDown Osc, [2]Buy/Sell zones, [3]Signals",1,3,1);

{ Up/Down ratio }
up:=Sum(C>Ref(C,-pds),pds);
down:=Sum(C<Ref(C,-pds),pds);
neutral:=Max(Sum(C=Ref(C,-pds),pds),1);
x:=(up/neutral-down/neutral)*50/pds+50;

{ Automatic overBought/Sold Osc levels }
avg:=Cum(x)/Cum(IsDefined(x));
pk:=Ref(x,-1)=HHV(x,3) AND Ref(x,-1)>avg;
pkVal1:=ValueWhen(1,pk,Ref(x,-1));
pkVal2:=ValueWhen(2,pk,Ref(x,-1));
oBought:=Cum(pkVal1)/Cum(IsDefined(pkVal1));

tr:=Ref(x,-1)=LLV(x,3) AND Ref(x,-1)<avg;
trVal1:=ValueWhen(1,tr,Ref(x,-1));
trVal2:=ValueWhen(2,tr,Ref(x,-1));
oSold:=Cum(trVal1)/Cum(IsDefined(trVal1));

{ OverBought/Sold signals }
entry:=x<oSold;
exit:=x>oBought;

{ Clean signals }
init:=Cum(IsDefined(entry+exit))=1;
bin:=ValueWhen(1,entry-exit<>0 OR init,entry);
entry:=bin*(Alert(bin=0,2)
OR entry*Cum(entry)=1);
exit:=(bin=0)*(Alert(bin,2)
OR exit*Cum(exit)=1);

{ Plot in own window }
If(plot=1,oBought,0); {Grey}
If(plot=1,avg,0); {Grey}
If(plot=1,oSold,0); {Grey}
If(plot=1,x,If(plot=2,(x<oSold)-(x>oBought),
entry-exit))



UpDown_Oscillator
Source / From: TOP
equismetastock[at]yahoogroups[dot]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!