StockFetcher Forums · General Discussion · Unraveling Code | << >>Post Follow-up |

buyNsell 2 posts msg #76050 - Ignore buyNsell |
7/5/2009 9:51:43 PM Ever see 2, 3, 4 . . . variations with 100s of lines of code and wonder what changed or what the variables are referring to? Excel (or any other spreadsheet) can help answer the questions. This is NOT an attempt to explain a filter, its implementation or SF syntax. This is a way to find code changes and catalog variable calculations. The SF parser requires the nesting of variables to create complex calculations. See the “Trend” calculation at the bottom of the post. The code is taken from TRO’s posting in “Who really wants to find the next NTRI?” page 30. Find the differences: 1. Paste 1 version in column A. 2. Paste the other version in column C. 3. Place the formula =A1=C1 in column B. 4. Copy the formula and paste it to each row in column B that has an entry in column A or C. 5. This creates a column indicating the statements are the same, TRUE, or different, FALSE. 6. Adjusting FALSE rows. a. Column a & c are the same. FALSE is caused by imbedded spaces or (). Copy statement from 1 column to the other, false becomes true. b. The statements are transposed. Rearrange 1 column. Copy the formula from a row above the changes to the last row (ctrl-c, shift-ctrl-down arrow, enter). Like rows will turn true. c. The code has changed. Insert rows in column(s) A and/or C to align the next equivalent statement. Copy the formula from a row above the changes to the last row like rows will turn true. 7. Column B now identifies all the changes, FALSE statements. Compare /* FINDING THE NEXT NTRI FILTER Double Version - Dec 18, 2006 */ To /* FINDING THE NEXT NTRI FILTER - Dec 18, 2006 */. At the start 204 rows are used with 170 FALSE statements. 1. The false on line 2 is ignored. It’s a comment about the code. 2. FALSE on row 10, the statements don’t match. Column A is “set{Double, UpperLim * .50 }” and column C “set{ULCL, UpperLim - close}”. Insert 2 rows in column A above the FALSE statement. Copy the formula from row 8 to the remaining rows. There are now 134 FALSE rows. 3. The next FALSE is row 53, “and add column InPlayPct”, “add column ULCL”. Insert 2 rows in column A to align the code and copy formula from row 50 to the last row. There are now 15 FALSE statements. 4. the next FALSE is on row 193. Some of the criteria has changed. Adjust columns A & C to place the mismatches separate rows. The result, in 4 steps, is the identification 8 differences. 1 is a comment. 2 & 3 are from the removal of the ULCL variable.. 4 – 8 are changes in selection critera. So what’s in the variable? Copy the code to column A. Column B contains the variable name and column C is the calculation. Copy the formula to column C. Place () around the variables. Replace the variables with the original calculation. The use of () keeps the calculation order correct. Calculations inside () is done before outer calculations. 2 + 3 * 10 = 2 + 30 = 32 where (2 + 3) * 10 = (5) * 10 = 50 Col A the statement Col B name Col C the calculation Col A - set{UpperLim, High 52 week High} Col B - UpperLim Col C - High 52 week High Col A - set{LowerLim, Low 52 week Low} Col B - LowerLim Col C - Low 52 week Low Col A - set{ULCL, UpperLim - close} Col B - ULCL Col C - 52 wk high - close Col A - set{Double, UpperLim * .50 } Col B - Double Col C - 5 * 52 wk high Col A - set{LimDiff, UpperLim minus LowerLim} Col B - LimDiff Col C - (High 52 week High) minus (52 week Low) Col A - set{PPDiff, CLOSE minus LowerLim} Col B - PPDiff Col C - (CLOSE) minus (Low 52 week Low) Col A - set{PPDiv, PPDiff / LimDiff} Col B - PPDiv Col C - (close - 52 wk low) / (52 wk high - 52 wk low) Col A - set{BallOnx, PPDiv * 100} Col B - BallOnx ((close - 52 wk low) / (52 wk high - 52 wk low))* 100 Col C - Col A - set{BallOn, round(BallOnx,0)} Col B - BallOn Col C - round(((close - 52 wk low) / (52 wk high – 52 wk low))* 100,2) Continued a few lines of code later. Col A - set{T10, count(10 day slope of the close above 0,1)} Col B - T10 Col C - count(10 day slope of the close above 0,1) Col A - set{T60, count(60 day slope of the close above 0,1)} Col B - T60 Col C - count(60 day slope of the close above 0,1) Col A - set{T200, count(200 day slope of the close above 0,1)} Col B - T200 Col C - count(200 day slope of the close above 0,1) Col A - Set{a1, T200 * 1} Col B - a1 Col C - (count(200 day slope of the close above 0,1)) * 1 Col A - Set{a2, T60 * 10} Col B - a2 Col C - (count(60 day slope of the close above 0,1)) * 10 Col A - Set{a3, T10 * 100} Col B - a3 Col C - (count(10 day slope of the close above 0,1)) * 100 Col A - Set{aa, a1 + a2} Col B - aa Col C - ((count(200 day slope of the close above 0,1)) * 1) + ( (count(60 day slope of the close above 0,1)) * 10) Col A - Set{TREND, aa + a3} Col B - trend Col C - (((count(200 day slope of the close above 0,1)) * 1) + ((count(60 day slope of the close above 0,1)) * 10) + ((count(60 day slope of the close above 0,1)) * 10) + ((count(10 day slope of the close above 0,1)) * 100) The calculation column evaluates “TREND” that consists of 7 variables nested several levels deep. trend 1 find aa calculation 1.1 find a1 calculation 1.1.1 find T200 calculation 1.2 find a2 calculation 1.2.1 find T60 calculation 2 find a3 calculation 2.1 find t10 calculation |

chetron 2,817 posts msg #76051 - Ignore chetron |
7/5/2009 10:04:31 PM THANX buyNsell |

StockFetcher Forums · General Discussion · Unraveling Code | << >>Post Follow-up |

Copyright 2018 - Vestyl Software L.L.C.•Terms of Service | License | Questions or comments? Contact Us

EOD Data sources: DDFPlus & CSI Data
**Quotes delayed** during active market hours. Delay times are at least 15 mins for NASDAQ, 20 mins for NYSE and Amex. Delayed intraday data provided by DDFPlus