[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[EquisMetaStock Group] Countback-type Oscillator and signals



PureBytes Links

Trading Reference Links

I've been playing around with the Countback-type Oscillator below, 
and some signals based on it look promising on some charts.

Indicators/Oscillators of this type don't generally suffer from the 
lagging characteristics of mainstream smoothed indicators (e.g. 
Stoch, MACD, MAs, etc), and they lend themselves to promising signals.

Any suggestion for a suitable name for this oscillator is welcome.


MetaStock -> Tools -> Indicator Builder -> New
-> copy & paste complete formula between "---8<---" lines.

=========================
Countback-type Oscillator
=========================
---8<-------------------------------------

{ Countback-type oscillator & signals v2.0
  Incorporating automatic overBought/Sold levels
  Trade at own risk.

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

{ User inputs }
pds:=Input("Oscillator countback periods",
 1,252,21);
plot:=Input("plot:  [1]Oscillator,  [2]Signals",
 1,2,1);
type:=Input("signals: [1]OBought/Sold, [2]Higher Lo, Lower Hi",1,2,1);

{ Countback oscillator }
C1:=Ref(C,-1);
x:=Sum((C>C1)*(C-C1),pds)
 /Max(Sum(Abs(C-C1),pds),.000001)*100;

{ Automatic overBought/Sold 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));
pkValAvg:=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));
trValAvg:=Cum(trVal1)/Cum(IsDefined(trVal1));

{ OverBought/Sold signals }
entry:=x<trValAvg;
exit:=x>pkValAvg;

{ Higher troughs / lower peaks signals }
entry:=If(type=1,entry,
 trVal1>trVal2 AND x>pkVal1);
exit:=If(type=1,exit,
 pkVal1<pkVal2 AND x<trVal1);

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

{ Plot in own window }
If(plot=1,pkValAvg,0); {Grey}
If(plot=1,avg,0);      {Grey}
If(plot=1,trValAvg,0); {Grey}
If(plot=1,x,long-short)

---8<-------------------------------------


jose '-)
http://www.metastocktools.com






 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/equismetastock/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/equismetastock/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:equismetastock-digest@xxxxxxxxxxxxxxx 
    mailto:equismetastock-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    equismetastock-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/