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

[amibroker] Re: referencing custom indicator



PureBytes Links

Trading Reference Links

Hi - It looks like you just about have it.

I think that your requirement that VarX be initialized to 20 requires that
you use array notation. As you probably know, AFL (without using array
notation) operates on entire arrays at once. So AMA and AMA2 will operate
this way, and I'm sure they have their own built-in way of initializing
their arrays, but I dont know what that is. It is probably safe to assume
that they dont initialize it to 20   : - )

On the other hand, you dont have any such requirement for variable B, so I
would probably do it this way:

// calculate B for all bars (operates on entire array)
B = High - Low;  // substitute your own formula for calculating B
// now initialize VarX
VarX[0] = 20;
// now fill the rest of the VarX array
for( i = 1; i < Barcount; i++ )
    VarX[i] = B[i] * VarX[ i-1];

That should do it - try copying the code into AB.

Steve

----- Original Message ----- 
From: "ceesvh" <cees-vanhall@xxxxxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Thursday, April 08, 2004 5:18 AM
Subject: [amibroker] Re: initializing an array


> Hi Steve,
>
> I have gone through the help and the archives and I have tried the
> solutions of TJ.
>
> Each Bar I calculate a variable VarX by multiplying the VarX of the
> previous Bar by another variable B. Variable B is recalculated each
> Bar.
>
> VarX[t]=b*varX[t-1];
>
> It looked like I could solve my problem using the AMA2 function.
> In the manual is stated (page 258)
>  Quote
>  Internally this function works like this:
>  today_ama=SMOOTHINGFACTOR*array+FEEDBACKFACTOR*yesterday_ama
>  Unquote
> As I do not need the array I thought the value of the moothingfactor
> should be zero
>
> Varx=AMA2(Close,0,B);
>
> I alo tried
>
> Varx=AMA2(Close,1,B);
>
> But it did not give the required results.
> I hope that you or anybody else can help me out.
>
> PS
> I am translating the Dynamic Breakout Indicator from EL to Afl.
> It works moothly in EL and the results are encouraging but I prefer
> to use AB
>
>
> cees
>
>
>
>
> --- In amibroker@xxxxxxxxxxxxxxx, "Steve Dugas" <sjdugas@xxxx> wrote:
> > Hi,
> >
> > TJ has shown several times how to use AMA and AMA2 functions for
> this type
> > of thing. You can find more info by using the search tab in the
> help. I dont
> > know how AB determines the initial value for these functions, but
> to
> > initialize it yourself I think you would have to do it the long
> way, for
> > example:
> >
> > vara[0] = 20;
> > for( i = 1; i < barcount; i++ )
> >     vara[i] = your formula including "vara[ i-1]" for yesterday's
> value;
> >
> > Steve
> >
> > ----- Original Message ----- 
> > From: "ceesvh" <cees-vanhall@xxxx>
> > To: <amibroker@xxxxxxxxxxxxxxx>
> > Sent: Wednesday, April 07, 2004 4:02 PM
> > Subject: [amibroker] initializing an array
> >
> >
> > >
> > > hello,
> > >
> > > I have seen in the archives that this topic has been dicussed in
> > > november 2002 resulting in 2 emails of Tomasz. However I believe
> > > that my problem is different.
> > >
> > > For ech bar I calculate the value of the variable vara using the
> > > value of vara of the previous bar except for the first bar when
> the
> > > value of vara is 20.
> > >
> > > first bar          vara=20
> > > all other bars     vara=function of vara previous bar.
> > >
> > > I am familiar with other languages where I should use the
> following
> > > syntax
> > > eg. if currentbar=1 then vara=20;
> > >
> > > However that is not the way Afl works.
> > >
> > > all help is appreciated
> > >
> > > cees
> > >
> > >
> > >
> > >
> > >
> > > Send BUG REPORTS to bugs@xxxx
> > > Send SUGGESTIONS to suggest@xxxx
> > > -----------------------------------------
> > > Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx
> > > (Web page: http://groups.yahoo.com/group/amiquote/messages/)
> > > --------------------------------------------
> > > Check group FAQ at:
> > http://groups.yahoo.com/group/amibroker/files/groupfaq.html
> > > Yahoo! Groups Links
> > >
> > >
> > >
> > >
> > >
> > >
>
>
>
>
> Send BUG REPORTS to bugs@xxxxxxxxxxxxx
> Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
> -----------------------------------------
> Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx
> (Web page: http://groups.yahoo.com/group/amiquote/messages/)
> --------------------------------------------
> Check group FAQ at:
http://groups.yahoo.com/group/amibroker/files/groupfaq.html
> Yahoo! Groups Links
>
>
>
>
>
>




------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges or Refill Kits for your HP, Epson, Canon or Lexmark
Printer at MyInks.com.  Free s/h on orders $50 or more to the US & Canada.
http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/mOAaAA/3exGAA/qnsNAA/GHeqlB/TM
---------------------------------------------------------------------~->

Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
Yahoo! Groups Links

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

<*> 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/