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

[amibroker] Re: Help re converting metastock code



PureBytes Links

Trading Reference Links

The code is interesting. Can anyone suggest how to fix this small bug:

With the chart displayd, hit Home key to see the bug.

It looks like this line should be modified:

for (i=periods; i<BarCount; i++)

Tnx, Lester

--- In amibroker@xxxxxxxxxxxxxxx, "Ton Sieverding" <ton.sieverding@xxx> wrote:
>
> Yes, I did that already. Thanks ....
> 
> Regards, Ton.
> 
>   ----- Original Message ----- 
>   From: dbw451 
>   To: amibroker@xxxxxxxxxxxxxxx 
>   Sent: Friday, March 02, 2007 1:52 PM
>   Subject: RE: [amibroker] Re: Help re converting metastock code
> 
> 
> 
>   Hi Ton,
> 
> 
> 
>   You could substitute the Hull MA for the LinReg.  I was just converting MetaStock code as it was posted on the forum and made a channel out of it.   All you would need to do is substitute the line:
> 
> 
> 
>   LR = LinearReg(C,periods);
> 
> 
> 
>   With the line:
> 
> 
> 
>   LR = WMA( 2*WMA(C,int(periods/2))- WMA(C,periods),int(sqrt(periods)));  // Hull MA
> 
> 
> 
>   Regards,
> 
> 
> 
>   David
> 
> 
> 
> 
> ------------------------------------------------------------------------------
> 
>   From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On Behalf Of Ton Sieverding
>   Sent: 03/02/2007 4:09 AM
>   To: amibroker@xxxxxxxxxxxxxxx
>   Subject: Re: [amibroker] Re: Help re converting metastock code
> 
> 
> 
>   Thanks for the code David. But why not using the Hull MA in stead of the LinReg ? Just to get the same lunch from the same kitchen ...
> 
> 
> 
>   Regards,
> 
>   Ton Sieverding.
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
>     ----- Original Message ----- 
> 
>     From: dbw451 
> 
>     To: amibroker@xxxxxxxxxxxxxxx 
> 
>     Sent: Friday, March 02, 2007 12:12 AM
> 
>     Subject: RE: [amibroker] Re: Help re converting metastock code
> 
> 
> 
>     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




------------------------ Yahoo! Groups Sponsor --------------------~--> 
Transfer from your equities account.  
Receive up to $1,000 from GFT. Click here to learn more.
http://us.click.yahoo.com/aZttyC/X_xQAA/cosFAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to 
SUPPORT {at} amibroker.com

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

For other support material please check also:
http://www.amibroker.com/support.html
 
Yahoo! Groups Links

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

<*> Your email settings:
    Individual Email | Traditional

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

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

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

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