Stock Portfolio Organizer

The ultimate porfolio management solution.

Shares, Margin, CFD's, Futures and Forex
EOD and Realtime
Dividends and Trust Distributions
And Much More ....
For Portfolio Manager Click Here

WiseTrader Toolbox

#1 Selling Amibroker Plugin featuring:

Advanced Adaptive Indicators
Advanced Pattern Exploration
Neural Networks
And Much More ....
Find Out More Here

BarsSince Nth event for Metastock
martin3
over 13 years ago
Metastock

Rating:
0 / 5 (Votes 0)
Tags:
metastock

counts bars since Nth event (last event, 2nd last, etc), with multiple output choices

By Jose Silva at MetastockTools.com

Indicator / Formula

Copy & Paste Friendly

MetaStock -> Tools -> Indicator Builder -> New -> Copy and paste complete formula

{ ©Copyright 2005 Jose Silva }
{ For personal use only }
{ http://www.metastocktools.com }

{ User inputs }
NthEvent:=Input("BarsSince Nth event  (1=last, 2=2nd last, etc)",1,1000,2);
plot:=Input("plot:  [1]BarsSince Nth event,  [2]Event signals",1,2,1);

{ Event peak example }
signal:=PeakBars(1,L,.01)=0;

{ Count events backwards }
count:=LastValue(Cum(signal))-Cum(signal)+1;

{ BarsSince Nth event }
BarsSinceNth:=
 HighestSinceBars(NthEvent+1,signal,count)-1;

{ Plot in own window }
If(plot=1,BarsSinceNth,signal)

0 comments

Leave Comment

Please login here to leave a comment.

Back