V.6:11 (432-433): {Put}, @Index vs. Copy by A.O.T. Fayiga, M.D.
Product Description
{Put}, @Index vs. Copy
by A.O.T. Fayiga, M.D.
When writing macros in Lotus 1-2-3, one always tries to find the programming method that runs the
fastest. But complexity is not synonymous with speed. Sometimes, using {Put}, @Index, and {For} loops
saves you a lot of time, but when the formula you are using is fixed, you will find that a macro using the
Copy command runs much faster.
As an exercise, we can use the recent series of S&C articles by Jim Summers that developed Lotus
programming for J. Welles Wilder's true range (TR1) and Directional Movement Index (DMI). (The
column described static and dynamic loops using {Put} and @Index commands in the July 1988 issue.)
Using the Copy command and range names, the macro in Figure 1 runs about six times faster than a
complicated {Put}, @Index and {For} loop which serves you best when you have a truly dynamic macro
in which the contents of lines are changing as the loop executes.
To try the Copy method, make a copy of the TR1 file developed in Summers' columns and give it a
different name (I call mine MYTR1 .WK 1). Delete the range names Process, Ctr0, Ctr1 and Ctr3 that
you will not be using in this method and assign the range names in Figure 2.
Erase the current lines in macro \x and enter the macro shown in Figure 1. Then enter the following
formulas in the designated cells. Below each formula, I have described what you should see in the control
panel after pressing Edit, but just with your cell-pointer in each of these cells, you see how you are
calculating the TR1, +DMI and -DMI. Nested @If commands are used in F242 and G242. The F242
formula is the +DMI on an up-day/outside up-day. G242 is the -DMI on a down-day/outside down day:
FOR THOSE ORDERING ARTICLES SEPARATELY:
*Note: $2.95-$5.95 Articles are in PDF format only. No hard copy of the article(s) will be delivered. During checkout, click the "Download Now" button to immediately receive your article(s) purchase. STOCKS & COMMODITIES magazine is delivered via mail. After paying for your subscription at store.traders.com users can view the S&C Digital Edition in the subscriber's section on Traders.com. Take Control of Your Trading. |
Professional Traders' Starter Kit |
All these items shown below only $299.99! |
5-year subscription to Technical Analysis of STOCKS & COMMODITIES, The Traders' magazine. (Shipping outside the US is extra. Washington state addresses require sales tax based on your locale.) 5 year access to S&C Archive 5 year access to S&C Digital Edition5-year subscription to Traders.com Advantage. 5-year subscription to Working Money. Free book selection. |
|
Click Here to Order |
|