Hi
Russ,
I took a quick look
at the alanhull website and at first glance did not see anything about your
indicator. I guess I need to register? Anyways the indicator
looked interesting to me and I thought having the indicator above the prices
would also be beneficial, so I created a channel. For lack of a better
name, I call it a Hull channel. What?s interesting
about the Hull channel is that it shows consolidation
vs. trending pretty well. The consolidation areas are bracketed by flat
lines where the trending areas the channel has a slope. The trending
part of the channel is actually very similar to a Keltner channel.
Here?s the Hull channel code if anyone is
interested:
//
//
Hull Channel
//
periods =
Param("periods",
13,2,100,1);
ATRmult =
Param("ATR
mult",
2.5,1.0,6.0,.25);
LR =
LinearReg(C,periods);
LR_ATRl = LR
- (ATR(periods)*ATRmult);
LR_ATRu = LR
+ (ATR(periods)*ATRmult);
HClower =
0;
// Hull
Channel upper line
HCupper =
0;
// Hull
Channel lower line
for (i=periods;
i<BarCount; i++)
{
if(LR[i] >
HClower[i-1])
{
if(LR_ATRl[i]
> HClower[i-1])
HClower[i] = LR_ATRl[i];
else
HClower[i] = HClower[i-1];
}
else
HClower[i] = LR[i];
if(LR[i] <
HCupper[i-1])
{
if(LR_ATRu[i]
< HCupper[i-1])
HCupper[i] = LR_ATRu[i];
else
HCupper[i] = HCupper[i-1];
}
else
HCupper[i] = LR[i];
}
Plot( HClower,
"HC
lower",
ParamColor("HC
color", colorWhite ), ParamStyle("HC
style")
);
Plot( HCupper,
"HC
upper",
ParamColor("HC
color", colorWhite ), ParamStyle("HC
style")
);
Regards,
David
From:
amibroker@xxxxxxxxxps.com [mailto:amibroker@yahoogroups.com]
On Behalf Of
russ_shor
Sent:
03/01/2007 4:04 AM
To:
amibroker@xxxxxxxxxps.com
Subject: [amibroker] Re: Help re
converting metastock code
Hi David
thanks for the code. Please check out www.alanhull.com.au. His
online
tutorial is very interesting.
Kind regards
Russ
---
In amibroker@xxxxxxxxxps.com,
"dbw451" <dbw451@xxx> wrote:
>
> Hi Russ,
>
>
>
> The MetaStock PREV function is a strange function that
represents the
> previous value of the function which contains it. I
chose to write
a loop
> to calculate the indicator values. Your
indicator looks
interesting; what
> is it called and how do you use
it?
>
>
>
> The following code was written for
readability to help explain the PREV
> function, not minimal code
optimization (although the code is fast as
> written):
>
>
>
> // MetaStock Code
>
> //
if(LinearReg(C,13)>PREV,if(LinearReg(C,13)-(ATR(13)*2.5)>PREV,
>
> //
LinearReg(C,13)-(ATR(13)*2.5),PREV),LinearReg(C,13));
>
>
>
> periods = Param("periods",
13,2,100,1);
>
> LR = LinearReg(C,periods);
>
>
LR_ATR = LR - (ATR(periods)*2.5);
>
>
>
>
MyInd = 0; // Indicator to calculate, MyInd[i-1] = MetaStock PREV
>
> PREV = 0;
>
>
>
> for (i=periods;
i<BarCount; i++) {
>
> PREV[i] = MyInd[i-1];
>
>
if(LR[i] > PREV[i]) {
>
> if(LR_ATR[i] > PREV[i])
>
> MyInd[i] = LR_ATR[i];
>
> else
>
> MyInd[i]
= PREV[i];
>
> }
>
> else
>
> MyInd[i]
= LR[i];
>
> }
>
>
>
> Plot( MyInd,
"My Indicator", ParamColor("My Ind color", colorRed ),
>
ParamStyle("My Ind style") );
>
>
>
>
>
> Regards,
>
>
>
> David
>
>
>
> _____
>
> From: amibroker@xxxxxxxxxps.com
[mailto:amibroker@xxxxxxxxxps.com]
On
Behalf
> Of russ_shor
> Sent: 02/28/2007 7:40 AM
> To: amibroker@xxxxxxxxxps.com
>
Subject: [amibroker] Help re converting metastock code
>
>
>
> Hi re a lower deviation metastock can someone help convert
to
> Amibroker. I use version 4.6
>
> Metastock
code:
>
If(LinearReg(c,13)>PREV,If(LinearReg(C,13)-(ATR(13)*2.5)>PREV,LinearReg(C,13
>
)-(ATR(13)*2.5),PREV,LinearReg(C,13));
>