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

Re: Exe too large



PureBytes Links

Trading Reference Links

"Glenn Crumpley" <glenn@xxxxxxx> asks:
>This is a very small piece of code, even though some parts reference
>externally defined functions which contribute to the total size. 
>
>Is it normal to expect this error from this quantity and type of code?
>
>If so, what should I do--Code every line in a different module?  Seriously.

Unfortunately, whenever you reference an external function, its code gets
included in the size of your exe - no shared libraries here.  There are
some standard coding "tricks" you can use, though to minimize the problem.

Most importantly, catch the value of those called functions in a variable,
and then reference that variable whenever you're using it more than once.

For example, you use "PercentR(PctRLen)" frequently, as well as
"BollingerBand((PercentR(PctRLen)),..."  BBands use a standard deviation
function, which adds bulk.

Also, most of the built-in functions are written really inefficiently,
and can be reduced in size and speeded up considerably.  I see you use
ADX, and from personal experience, I can say it's amazingly inefficient.

I haven't looked at the MRO function, but it may be another killer.

It may seem like a small, simple system, but those function calls, and
their function calls, ad nauseum, really add up.

Good luck,

Jim

>LinearRegSlope((ADX(18)),3)>0 and
>MRO(PercentR(PctRLen)>BollingerBand((PercentR(PctRLen)),7,1.5),30,1)>MRO(Per
>centR(PctRLen)<BollingerBand((PercentR(PctRLen)),7,-1.5),30,1) then Sell at
>Market;
>
>IF PercentR(PctRLen)>BollingerBand((PercentR(PctRLen)),7,1.5) then begin
>   Print("Date: ",Date,"  PercentR:",PercentR(PctRLen),"
>BBUp:",BollingerBand((PercentR(PctRLen)),7,1.5));
>   ExitShort("BBUp") at Market;
>End;