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

Re: Where's the Board???



PureBytes Links

Trading Reference Links

Re: Pierre's EL optimizations:

> Lets take the first 3 lines
> VALUE1 = @MOMENTUM(C,3);
> VALUE2 = @MOMENTUM(C,3)[1];
> VALUE3 = .03*(VALUE1-VALUE2)+(1-.03)*VALUE3;
>   ...
> Sould be now obvious to anyone that this could reduce to:
> Value0=c-c[1];
> Value3= .03*(value0-value0[3])+ (1-.03*)value3; 
> 
> (could also replace 1-0.03 by .97)

This is excellent and creative optimization, and will definitely 
result in faster-running code.

**HOWEVER**:

Unless maximum blinding speed is your key requirement, this may not 
be the best way to write your code.  Code like this has a tendency to 
be "write-only" -- nobody (yourself included, if you come back to it 
2 weeks from now) is going to understand it.  If you want to refer 
back to the indicator at a later time, maybe to improve it or to 
incorporate it into other code, you might have a tough time 
deciphering the optimized code.

IMHO, in many/most cases, clear and understandable code is more 
important than tweaked-to-the-Nth-degree code.

If you decide that you really do require maximally-optimized code 
like Pierre derived, then I suggest you do yourself a favor.  Be sure 
to include the *original* unoptimized code, AND if appropriate the 
manipulations you performed to optimize it, as a COMMENT in your 
code.  That way you can come back to the code at a later time and 
still understand what it's doing.

Gary