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

Boxed Ellipse for Metastock
martin3
about 14 years ago
Metastock

Rating:
0 / 5 (Votes 0)
Tags:
metastock
Draws boxes based on high & low of selected period, and draws ellipses within them.

By Jose Silva at MetastockTools.com

Screenshots

Files

Indicator / Formula

Copy & Paste Friendly

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

{ Boxed Ellipses v2.0
  Box: High & Low of selected period.
  Ellipse: plots within Box boundaries.
 ©Copyright 2005 Jose Silva.
  http://www.metastocktools.com
  W/thanks to MG Ferreira for ellipse equation.}

pds1:=Input("Ellipse/Box width periods",
 2,2600,40);
pds2:=Input("Ellipse/Box separation periods",
 -26000,2600,5);
plot:=Input("plot:  [1]Box,  [2]Ellipse,  [3]Both",1,3,3);
pds2:=LastValue(If(pds2<=-pds1,-pds1+1,pds2));

{ Box & Ellipse 1 }
p2:=pds2;
p1:=pds1+p2;
start:=Cum(1)=LastValue(Cum(1))-p1;
end:=Cum(1)=LastValue(Cum(1))-p2;
restrict:=Ref(Ref(ValueWhen(1,start,1),-p2),p2);
Hi:=LastValue(Highest(ValueWhen(1,restrict,H)))
 +restrict-1;
Lo:=LastValue(Lowest(ValueWhen(1,restrict,L)))
 +restrict-1;
top:=If(start OR end,Lo,Hi);
bot:=If(start OR end,Hi,Lo);

midX:=(p1-p2)/2;
midY:=(Hi-Lo)/2;
tX:=Cum(1)-midX-(LastValue(Cum(1))-p1);
ellipse:=
 Sqrt(midY*midY*(1-Min(tX*tX/midX/midX,1)));
upperE:=Lo+midY+ellipse;
lowerE:=Hi-midY-ellipse;

If(plot=2,upperE,Hi);
If(plot=2,lowerE,Lo);
If(plot=2,upperE,top);
If(plot=2,lowerE,bot);
If(plot=1,top,upperE);
If(plot=1,bot,lowerE);

{ B&E 2 }
p2:=p1+pds2;
p1:=pds1+p2;
start:=Cum(1)=LastValue(Cum(1))-p1;
end:=Cum(1)=LastValue(Cum(1))-p2;
restrict:=Ref(Ref(ValueWhen(1,start,1),-p2),p2);
Hi:=LastValue(Highest(ValueWhen(1,restrict,H)))
 +restrict-1;
Lo:=LastValue(Lowest(ValueWhen(1,restrict,L)))
 +restrict-1;
top:=If(start OR end,Lo,Hi);
bot:=If(start OR end,Hi,Lo);

midX:=(p1-p2)/2;
midY:=(Hi-Lo)/2;
tX:=Cum(1)-midX-(LastValue(Cum(1))-p1);
ellipse:=
 Sqrt(midY*midY*(1-Min(tX*tX/midX/midX,1)));
upperE:=Lo+midY+ellipse;
lowerE:=Hi-midY-ellipse;

If(plot=2,upperE,Hi);
If(plot=2,lowerE,Lo);
If(plot=2,upperE,top);
If(plot=2,lowerE,bot);
If(plot=1,top,upperE);
If(plot=1,bot,lowerE);

{ B&E 3 }
p2:=p1+pds2;
p1:=pds1+p2;
start:=Cum(1)=LastValue(Cum(1))-p1;
end:=Cum(1)=LastValue(Cum(1))-p2;
restrict:=Ref(Ref(ValueWhen(1,start,1),-p2),p2);
Hi:=LastValue(Highest(ValueWhen(1,restrict,H)))
 +restrict-1;
Lo:=LastValue(Lowest(ValueWhen(1,restrict,L)))
 +restrict-1;
top:=If(start OR end,Lo,Hi);
bot:=If(start OR end,Hi,Lo);

midX:=(p1-p2)/2;
midY:=(Hi-Lo)/2;
tX:=Cum(1)-midX-(LastValue(Cum(1))-p1);
ellipse:=
 Sqrt(midY*midY*(1-Min(tX*tX/midX/midX,1)));
upperE:=Lo+midY+ellipse;
lowerE:=Hi-midY-ellipse;

If(plot=2,upperE,Hi);
If(plot=2,lowerE,Lo);
If(plot=2,upperE,top);
If(plot=2,lowerE,bot);
If(plot=1,top,upperE);
If(plot=1,bot,lowerE)

0 comments

Leave Comment

Please login here to leave a comment.

Back