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

Re: Better Method



PureBytes Links

Trading Reference Links


-----Message d'origine-----
De : Bob Fulks <bfulks@xxxxxxxxxxxx>
À : Philippe <plhermie@xxxxxxxxxxxxxxxx>
Cc : omega-list@xxxxxxxxxx <omega-list@xxxxxxxxxx>
Date : dimanche 2 mai 1999 19:02
Objet : Re: Better Method


(snip)
>
>Pierre's solution is much faster in terms of run time since the MRO
>function uses a loop, as did Gary's original solution, but Pierre's takes a
>little more code.

Yes, but when yo con,sider  length of code ( or code complexity), you need
to take in account any function that is called by the master code.
You can write a one line length code that call user fuction (even
imbricated) , then the  global code  has no to be considered  as shorter.

>
>My solution takes less code but is slower to run since it uses a more
>complex internal function.

It takes less code for the master calling code.
but is calls the MRO function , that is an EL code ( ven if it wasan iternal
one, it makes no diffeerence in the principle of code length determination).
Here is the MRO function:

{ *******************************************************************

 Study  : MRO
  Last Edit : 7/7/95
 Provided By : Omega Research, Inc. (c) Copyright 1995

********************************************************************}
inputs  : Expr(TrueFalseSeries),Length(NumericSimple), Occur(NumericSimple);
vars    : Counter(0),J(0);

J = 0;
Counter = 0;
while J < Length and Counter < Occur
begin
 if Expr[J] then Counter = Counter + 1;
 J = J + 1;
end;
if Counter >= Occur and Counter > 0 then
 MRO = J - 1 + CurrentBar - BarNumber
else
 MRO = -1;

Then you may see that the use of MRO function does not simplify anything.
However, testing the absence of inverse condition was a clever idea to your
credit.

The difference are as below:
>
>Gary's improvement on my version saves some search time by searching only
>back to the target bar and using the "not found" return value of -1 from
>the MRO function.
>
>We all had slightly different interpretations of the length of the search
>as illustrated below.
>
>To test these I created a ShowMe for each:
>
>My original solution:
>
>    Input: Length(3);
>    if MRO(C <= C[1], 30, 1) > Length then Plot1(High,"1";
>

1) While loop and counters called by MRO, each bar ==> lot of calculation

>Pierre's (slightly simplified by Gary):
>
>    Input: N(4);
>    Vars: Idx(0);
>    if  c > c[1] then idx = idx + 1;
>    if idx - inx[N] = N then Plot1(Low,"1");
>

2) No loop, no hidden code called than what 's above. This is the fastest
solution.

3) Original solution calling  the for loop every bar ==> see (1) problem

snip.
>
>Bob Fulks
>

This is strange, but what happens to Omega List ?
Are we going to discuss some interesting points after so many months ?

Sincerely

-Pierre Orphelin
Représentant exclusif de Omega Research en France.
web: http://www.sirtrade.com