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

Re: [amibroker] Re: Calculating bars between two arguments



PureBytes Links

Trading Reference Links

Markus,

When you are using the Explore function, you need the( Filter= )
statement.

As for Cum(1);
I believe Cum(1) returns: 1+1+1+1+1+1+1+1+1+1+1+1+1+.........etc.
starting from the first Bar or Day in the Ticker database.

Cum(2) doubles the output. ....etc. For example, try the explore below,
and change Cum(1) to Cum(2).
****************************************************
Load this into AA, select n last quotations and n=1, click explore.

Filter=1;
AddColumn(Cum(1),"Total number of bars in database",1);//Or Days
AddColumn(Cum(1)/256,"Years of Data");
****************************************************
The output should be the total number of bars in the tickers database,
and we relate BARS to DAYS ( TIME ).

Therefore with the following statement:
zz=ValueWhen(z,x,1);
My value for zz is the Bar( or Date ) that z was true and the same for
yy=,
so if z was true on Bar 2000 or Day2000 ( zz ) and y was true on bar
2500 or Day2500 ( yy ) then Bars between z and y would be
abs(zz(2000)-yy(2500))=500 bars or days.


I hope I have given a clear understanding, If not let me know.

Anthony

IVA GmbH wrote:

> Anthony,
>
> I was away for a couple of days and thus couldnīt answer.
>
> This weird cum(1) functin is still a mystery to me: cum(1) returns "1"
> right
> (0+1), right? whereas cum(2) would return "3", correct(0+1+2)???!!
>
> On the other hand, it is sais in the help section that cum(1)
> calculates a
> mov. average rising one point each day since the beginning of the
> chart1 How
> come? How can the cumulative sum of a CONSTANT rise by one each day??
> This
> sounds not like being the same!?
>
> I still have sort of a hard time understanding fully what you did.
> Please be
> patient! I found out Iīm not the programmer type of guy!
>
> Besides, do I have to specify that filter=1 in any case if I want all
> quotes
> for all stocks in my database to be examined?? Didnīt I specify that
> already
> by clicking on the "all quotes" and n=1?? I saw this filter=1 in some
> you
> your guysī code in in some not. So????
>
> The rest of the code seems to point to the right direction (wher eI
> intend
> to go).
>
> I still might need your help along the way...
>
> Already many thanks!!!!!
>
> Markus
>
> ----- Original Message -----
> From: "Anthony Faragasso" <ajf1111@xxxx>
> To: <amibroker@xxxxxxxxxxxxxxx>
> Sent: Sunday, June 30, 2002 12:43 AM
> Subject: Re: [amibroker] Re: Calculating bars between two arguments
>
>
> > Markus,
> >
> > I am guessing what you want here, but, as you know By default
> Valuewhen
> > () selects the most recent occurrence or ( 1 ), if you want the
> second
> > most recent occurrence then your code should look like the
> following.
> > Notice where I have placed the 2's.
> >
> > x=Cum(1);
> >
> > z=IIf(Low<Ref(LLV(Low,5), -1),1,0);
> > zz=ValueWhen(z,x,2);
> > Low1=ValueWhen(z,Low,2);
> >
> >
> > y=IIf (High>Ref(HHV(High,5), -1),1,0);
> > yy=ValueWhen(y,x,2);
> > High1=ValueWhen(y,High,2);
> >
> > Filter=1;
> > AddColumn(Low1,"Low");
> > AddColumn(ValueWhen(z,DateNum(),2),"date Z",1);
> > AddColumn(High1,"high");
> > AddColumn(ValueWhen(y,DateNum(),2),"date Y",1);
> > AddColumn(abs(zz-yy),"Bars between",1);
> >
> > Does this help
> > Anthony
> >
> > IVA GmbH wrote:
> >
> > > Anthony,
> > >
> > > what is cum(1) for?
> > >
> > > Donīt I have to specify in valuewhen on which occurence the
> statement
> > > has to
> > > be true??
> > >
> > > The code runs but Iīd like to know WHAT it detects...
> > > Thanks
> > >
> > > Markus
> > > ----- Original Message -----
> > > From: "Anthony Faragasso" <ajf1111@xxxx>
> > > To: <amibroker@xxxxxxxxxxxxxxx>
> > > Sent: Saturday, June 29, 2002 11:34 PM
> > > Subject: Re: [amibroker] Re: Calculating bars between two
> arguments
> > >
> > >
> > > > Does this help:
> > > >
> > > > x=Cum(1);
> > > >
> > > > z=IIf(Low<Ref(LLV(Low,5), -1),1,0);
> > > > zz=ValueWhen(z,x);
> > > >
> > > >
> > > > y=IIf (High>Ref(HHV(High,5), -1),1,0);
> > > > yy=ValueWhen(y,x);
> > > >
> > > > Filter=1;
> > > > AddColumn(ValueWhen(z,DateNum()),"date Z",1);
> > > > AddColumn(ValueWhen(y,DateNum()),"date Y",1);
> > > > AddColumn(abs(zz-yy),"Bars between");
> > > >
> > > > IVA GmbH wrote:
> > > >
> > > > > Dimitris,
> > > > >
> > > > > thanks for taking the time.
> > > > >
> > > > > I understand what you said about z and y. As far as zz and yy
>
> > > goes,
> > > > > they
> > > > > are giving me a specific low and or high value, right? And
> thus,
> > > why
> > > > > is the
> > > > > time interval between them "meaningless" (what do you mean by
> > > THAT,
> > > > > please?). The reason to split the forumula in z and zz is just
> for
> > >
> > > > > easier
> > > > > reading. I could have put everything in one formula as I did
> > > below.
> > > > >
> > > > > I basically tried to determine howe many bars (i.e. time
> interval)
> > >
> > > > > would be
> > > > > in between thos two conditions. I thought of datenum function
> but
> > > > > realized
> > > > > that I could not use them for computation like datenum(yy) -
> > > > > datenum(zz) to
> > > > > determine the time interval (number of days).
> > > > >
> > > > > I assume that barssince is as well not an ideal solution since
> you
> > > see
> > > > > for
> > > > > zz that I want to check when the condition was true for the
> FIRST
> > > > > time. This
> > > > > is someting barssince doesnīt provide. It could for instance
> > > happen
> > > > > that
> > > > > z/zz happened AFTER y/yy (looking from retrospective). In this
>
> > > case I
> > > > > want
> > > > > those signals to be skipped since this case doesnīt apply to
> the
> > > > > pattern I
> > > > > try to detect.
> > > > >
> > > > > I cut and pasted the code below and got and error message
> (need to
> > >
> > > > > define a
> > > > > filter variable). What is the problem here? I went one step
> > > further
> > > > > and put
> > > > > the conditions for z and zz together like
> > > > > z=ValueWhen((IIf(Low<Ref(LLV(Low,5), -1),1,0)==1),Low,1) but
> again
> > > got
> > > > > the
> > > > > same error. I canīt see my mistake! Everything seems to be
> logic??
> > >
> > > > >
> > > > > What information would you need to judge how to go, Dimitris?
> > > > >
> > > > > Many thanks!!!!!
> > > > >
> > > > > Markus
> > > > >
> > > > > ----- Original Message -----
> > > > > From: "dtsokakis" <TSOKAKIS@xxxx>
> > > > > To: <amibroker@xxxxxxxxxxxxxxx>
> > > > > Sent: Saturday, June 29, 2002 9:17 PM
> > > > > Subject: [amibroker] Re: Calculating bars between two
> arguments
> > > > >
> > > > >
> > > > > Hi Markus,
> > > > > There is something to be explained here:
> > > > > z and y are conditions, their value is 0 or 1.
> > > > > zz and yy are continuous functions with various values.
> > > > > Perhaps you need the time interval from z to y [or from y to
> z].
> > > It
> > > > > has some meaning, because z and y are events.
> > > > > The time interval between zz and yy is meaningless.
> > > > > Try the
> > > > > z=IIf(Low<Ref(LLV(Low,5), -1),1,0);
> > > > > zz=ValueWhen(z==1,Low,1);
> > > > > y=IIf (High>Ref(HHV(High,5), -1),1,0);
> > > > > yy=ValueWhen(y==1,High,1);
> > > > > Plot(z,"",1,2);Plot(y,"",4,2);
> > > > > Plot(zz,"",5,1);Plot(yy,"",7,1);
> > > > > to see what I mean.
> > > > > Can you be more specific ?
> > > > > DT
> > > > > --- In amibroker@xxxx, "IVA GmbH" <funnybiz@xxxx> wrote:
> > > > > > Folks,
> > > > > >
> > > > > > would someone help me with this:
> > > > > >
> > > > > > I need to calculate how many time periods have been passed
> since
> > >
> > > > > >
> > > > > > zz and yy
> > > > > >
> > > > > > whereby
> > > > > >
> > > > > > z=iif(low<Ref(llv(low,5), -1),1,0)
> > > > > > zz=valuewhen(z==1,low,1)
> > > > > >
> > > > > > and
> > > > > >
> > > > > > y=iif (high>Ref(hhv(high,5), -1),1,0)
> > > > > > yy=valuewhen(y==1,high,1)
> > > > > >
> > > > > > ???????????????
> > > > > >
> > > > > > I thought of
> > > > > >
> > > > > > barssince (y==1) - barssince (zz==1) but that dosnīt return
> the
> > > > > desired result.
> > > > > >
> > > > > > Thanks a lot!!
> > > > > >
> > > > > > Markus
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > Your use of Yahoo! Groups is subject to
> > > > > http://docs.yahoo.com/info/terms/
> > > > >
> > > > >
> > > > >
> > > > > Yahoo! Groups Sponsor
> > > > ADVERTISEMENT
> > > >
> > > > >
> > > > > Your use of Yahoo! Groups is subject to the Yahoo! Terms of
> > > Service.
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > Your use of Yahoo! Groups is subject to
> > > http://docs.yahoo.com/info/terms/
> > > >
> > > >
> > > >
> > >
> > >
> > > Yahoo! Groups Sponsor
> > ADVERTISEMENT
> >
> > >
> > > Your use of Yahoo! Groups is subject to the Yahoo! Terms of
> Service.
> >
> >
> >
> >
> >
> >
> > Your use of Yahoo! Groups is subject to
> http://docs.yahoo.com/info/terms/
> >
> >
> >
>
>
> Yahoo! Groups Sponsor
ADVERTISEMENT
[Click Here!]
>
> Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.