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

[amibroker] Re: General query about cumulating values for indicators



PureBytes Links

Trading Reference Links

The operative phrase here was "...at least not directly", as in the 
expectation that Ref(Value1, -1) would somehow be updating as a 
result of calculating new values for Value1 { from the original post: 
Value1=Ref(Value1,-1)+Value2 }

The poster correctly concluded that it doesn't work that way.

Mike

--- In amibroker@xxxxxxxxxxxxxxx, "Tomasz Janeczko" <groups@xxx> 
wrote:
>
> >> The bottom line it seems is that you cannot recursively alter the
> >> value of any array by referencing other values of that array... 
at
> >> least not directly.
> 
> Of course that you CAN. 
> 
> Recursion needs either:
> a) a loop
> 
> Value1=0;
> Value2=log(Close);
> for( i = 1; i < BarCount; i++ ) 
>   Value1[ i ] = Value1[ i -1 ] + Value2[ i ];
> 
> b) or AMA  / AMA2 http://www.amibroker.com/f?ama
> Value1 = AMA2( Value2, 1, 1 );
> 
> c) or CUM (this one is limited to simple "cumulation" while above 
two are universal)
> Value1 = Cum( Value2 );
> 
> A must read:
> http://www.amibroker.com/guide/h_understandafl.html
> 
> 
> Best regards,
> Tomasz Janeczko
> amibroker.com
> ----- Original Message ----- 
> From: "Mike" <sfclimbers@xxx>
> To: <amibroker@xxxxxxxxxxxxxxx>
> Sent: Thursday, May 22, 2008 10:32 PM
> Subject: [amibroker] Re: General query about cumulating values for 
indicators
> 
> 
> > Nope, you're not alone.
> > 
> > The topic pops up, in one form or another, every couple of weeks 
or 
> > so. Sounds like you understand the concept now.
> > 
> > Good luck.
> > 
> > Mike
> > 
> > --- In amibroker@xxxxxxxxxxxxxxx, "sidhartha70" <sidhartha70@> 
> > wrote:
> >>
> >> Thanks Mike.
> >> 
> >> So it seems I'm not the only one coming from more 'traditional'
> >> languages to struggle with this concept.
> >> 
> >> The bottom line it seems is that you cannot recursively alter the
> >> value of any array by referencing other values of that array... 
at
> >> least not directly.
> >> 
> >> 
> >> --- In amibroker@xxxxxxxxxxxxxxx, "Mike" <sfclimbers@> wrote:
> >> >
> >> > Read thread #122034 for a similar discussion, including 
> > explanation. 
> >> > 
> >> > Mike
> >> > 
> >> > --- In amibroker@xxxxxxxxxxxxxxx, "sidhartha70" <sidhartha70@> 
> >> > wrote:
> >> > >
> >> > > Hi All,
> >> > > 
> >> > > Can someone clear this up for me... I am simply trying to 
> > cumulate 
> >> > the
> >> > > value of an array. My intial thoughts were to do something 
like 
> > the
> >> > > following,
> >> > > 
> >> > > Value1=0;
> >> > > Value2=log(Close);
> >> > > Value1=Ref(Value1,-1)+Value2;
> >> > > 
> >> > > However, that doesn't seem to work... So I've ended up with,
> >> > > 
> >> > > Value2=log(Close);
> >> > > Value1=Cum(Value2);
> >> > > 
> >> > > Which does seem to work. I can't see why the first doesn't.
> >> > > 
> >> > > Can anyone explain...? Thanks
> >> > >
> >> >
> >>
> > 
> > 
> > 
> > ------------------------------------
> > 
> > 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
> > 
> > 
> >
>



------------------------------------

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/