PureBytes Links
Trading Reference Links
|
Hi all,
For me, the MRO function doesn't seem to me to be the right one to do this.
If the MRO function returns 22, it means that C[22] > C[23] is true but it
can be false for C[21] > C[22],.....etc..
Am I right ?
Sincerely,
Philippe
----- Original Message -----
From: pierre.orphelin <pierre.orphelin@xxxxxxxxxx>
To: <fritz@xxxxxxxx>; Bert <mbcsne@xxxxxxx>
Cc: <omega-list@xxxxxxxxxx>
Sent: Sunday, May 02, 1999 4:40 PM
Subject: Re: Better Method
>
> > Is there a better way to check for a series of similar events?
> > I know this works, but I can't believe it's the best way to do
> > it...... any help would be appreciated.
> > If C > C[1] and C[1] > C[2] and C[2] > C[3] and C[3] > C[4]
> > ........{etc. out to 7, 9, 17, or 23 days ago.....}
>
> A loop is probably the easiest way to do this:
>
> Vars: Idx(0);
>
> Condition1 = True;
> for Idx = 0 to Length-1 begin
> Condition1 = Condition1 AND C[Idx] > C[Idx+1];
> end;
>
> { Now Condition1 is True if you had Length consecutive rising closes }
>
> Gary
>
> =========
> Yes but there is a clever method that will avoid the for loop and take
> advantage of the maxbarsback concept:
>
> Vars: Idx(0);
> Condition1 = c>c[1];
> if Condition1 = then idx=idx+1;
>
> Now idx contains an updated running sum of occurences since the begining
of
> that database.
> The numbers are stored in the maxbarsback buffer up to mbb bars before
> curentbar
> If you want to check the N days ago condition then write:
>
> if idx-inx[N]= N then [do something....]
>
> Of course, if N occuences occured during the N previous bars, this is
> reflected by the fact that idx is N higher than inx[N] , Nbars ago.
> ( N must be less than mbb).
>
> This simple code avoids x for loops of length N where x = nb bars of
> database -mbb and N the number of occurence tested.
> The incraese of speed is proportional to (x*N-N)/x =x*(N-1)/x = N-1.
> roughly, I do discuss only on the for loop code)
>
> For a N=23 value you should expect a 22 times faster code.
>
>
> Sincerely,
>
> -Pierre Orphelin
> Représentant exclusif de Omega Research en France.
> web: http://www.sirtrade.com
>
>
>
|