I was looking for indicator called "autoenvelope" that automatically adjusts the channel. On other site, I found the formula for it on Metastock:
- Code: Select all
---------------------------------------------------------------------------------------------------------------------
{Dr A. Elder's AutoEnvelope interpretation v1.0}
{ User inputs }
pds:=Input("EMA periods",1,252,21);
pdsBak:=Input("lookback periods",1,252,42);
x:=Input("use: Open=1, High=2, Low=3, Close=4, WClose=5",1,5,4);
plot:=Input("[1]AutoEnvelope, [2]Long signals, [3]All signals",1,3,1);
delay:=Input("Entry/Exit signals delay",0,5,0);
{ Price field }
x:=If(x=1,O,If(x=2,H,If(x=3,L,If(x= 5,WC(),C))));
{ Envelope bands }
Avg:=Mov(x,pds,E);
hiAvg:=HHV(H,pdsBak);
loAvg:=LLV(L,pdsBak);
shift:=
Mov(If(hiAvg>Avg,hiAvg-Avg,Avg-loAvg),pds,E);
UpperBand:=Avg+shift;
LowerBand:=Avg-shift;
{ Envelope signals }
In:=Cross(x,LowerBand);
Out:=Cross(x,UpperBand);
Init:=Cum(In+Out>-1)=1;
InInit:=Cum(In)=1;
flag:=BarsSince(Init OR In)
<BarsSince(Init OR Out)+InInit;
signals:=Ref((InInit AND Alert(InInit=0,2)
OR flag AND Alert(flag=0,2))
-(flag=0 AND Alert(flag,2)),-delay);
{ Plot envelope on price chart }
If(plot=1,UpperBand,If(plot=2,signa ls,In-Out));
If(plot=1,Avg,If(plot=2,0,0));
If(plot=1,LowerBand,If(plot=2,signa ls,In-Out))
---------------------------------------------------------------------------------------------------------------------
Also this is the definition:
Envelope channels are set parallel to the moving average (parallel to the slow MA if you
use two MAs). The two channel lines must contain approximately 90-95% of all prices
for the past two or three months between them, with only the extremes protruding
outside. Envelope channels provide attractive profit targets – sell longs near the upper
channel line and cover shorts near the lower channel line.
The AutoEnvelope is a custom indicator - an original tool that automatically sizes
channels by calculating a standard deviation for the last 100 bars. It is designed to
change value at most once a week, making it suitable even for intra-day data.
· Base EMA (22) – This is the number of bars for the Exponential Moving Average plotted in the center of the channel.
· Factor (27) – This is the number of standard deviations (expressed in the tenths)
for creating the channel. Statistically, 2.7 is the proper size to use, but that
assumes a standard distribution, which is not always present in the markets. We
find that 27 works for most stocks using daily data, but you may want to adjust
this Factor to fit your trading vehicle and style.
--------------------------------------------------------------------------------------------------------------------
Perhaps somebody can help developing this indicator for Marketscope?
Thanks a lot beforehand.