StockFetcher Forums · General Discussion · Debugger question | << 1 2 >>Post Follow-up |
DrJimO 35 posts msg #124518 - Ignore DrJimO |
7/24/2015 5:53:57 PM OK - now I'm really snowed. When I last ran this code was before the market close. After your message, I took out the comments and it ran fine and produced results. Maybe my oversight. Don't know. Anyway, I got it working. Realised I was holding it too tight with the 1.10 value. Thanks for your help. |
DrJimO 35 posts msg #124521 - Ignore DrJimO |
7/24/2015 6:59:35 PM OK - You asked for it. I was trying to post small items, but here's the real filter I'm trying to create. It's copied from one posted by Kevin_in_GA recently, which I have modified. There are two problems. #1 both Set statements cause a syntax error in Debug. However, I added columns for the vars just to see if all was OK and they are correct. So, why is the debug picking these Sets up as an error? The only diffeerence I can see between the SET statements is spacing. Normally spacing doesn't matter in program code. #2 If I sort on any column less than 9, it seems to work OK, but column 9 (which is the sort I want) doesn't work, nor does it seem like any column above 9 works on the sort. -- Any idea why? Even with the posted errors on the sets the filter seems to be working correctly. The sort is a pain, but I can easily work around that. Here's the filter code. Most of it's from Kevin's post. -------------------------------------------------------------------------------------------------------------------- /*MEASURE THE DIFFERENCE FROM WEEKLY OPEN TO WEEKLY HIGH*/ set{whiop, weekly high - weekly open} set{Long_Profit, whiop / weekly open } /*DETERMINE THE FREQUENCY THAT 5% IS ACHIEVED OVER MULTIPLE TIME FRAMES*/ set{5_1wk, count(Long_Profit > .05,1)} set{5_4wk, count(Long_Profit > .05,4)} set{5_13wk, count(Long_Profit > .05,13)} /*DETERMINE THE FREQUENCY THAT 10% IS ACHIEVED OVER MULTIPLE TIME FRAMES*/ set{10_1wk, count(Long_Profit > .10,1)} set{10_4wk, count(Long_Profit > .10,4)} set{10_13wk, count(Long_Profit > .10,13)} /*APPLY WEIGHTING FACTORS*/ set{var1,5_4wk*0.5} /*WEIGHT 4 WK AVERAGE AT 2X*/ set{var2,5_13wk*0.07692} /*WEIGHT 13 WK AVERAGE AT 1X*/ set{var3,10_4wk*0.5} /*WEIGHT 4 WK AVERAGE AT 2X*/ set{var4,10_13wk*0.07692} /*WEIGHT 13 WK AVERAGE AT 1X*/ /*CREATE A WEIGHTED SUMMATION OF STOCK PERFORMANCE (MAX SCORE = 3) */ set{reward,var1+var2} set{reward2, var3 + var4} /*DETERMINE THE RISK OF TRIPPING A 10% STOP LOSS*/ set{wloss, weekly open - weekly low} set{max_loss, wloss / weekly open} /*DETERMINE THE FREQUENCY THAT A 10% STOP LOSS IS TRIPPED OVER MULTIPLE TIME FRAMES*/ set{loss_1wk, count(max_loss > .10,1)} set{loss_4wk, count(max_loss > .10,4)} set{loss_13wk, count(max_loss > .10,13)} /*APPLY WEIGHTING FACTORS*/ set{var11,loss_4wk*0.5} /*WEIGHT 4 WK AVERAGE AT 2X*/ set{var21,loss_13wk*0.07692} /*WEIGHT 13 WK AVERAGE AT 1X*/ /*CREATE A WEIGHTED SUMMATION OF RISK (MAX SCORE = 3) */ set{risk,var11+var21} set{performance,reward/risk} /* Count Instances where Profit Exceeds 8% */ set{gained_eight_percent, count(Long_Profit > .08 , 1)} and draw gained_eight_percent /* JJO Calculate and display price adjusted volume */ set { Adj_Vol, Volume(60) * close(60) } add column Adj_Vol { Dollar Volume} and add column separator /* JJO Add Market and Sector information */ and add column exchange and add column sector and add column industry and add column separator add column performance { Reward/Risk } add column reward {reward} add column risk {risk} add column 5_4wk {5% gain 4 wk} add column 5_13wk {5% gain 13 wk} add column separator add column 10_4wk {10% gain 4 wk} add column 10_13wk {10% gain 13 wk} add column loss_4wk {10% stop 4 wk} add column loss_13wk {10% stop 13 wk} add column separator /* for debugging --- var1 + var2 = reward, var11 and var21 = risk */ add column var1 add column var2 add column var11 add column var21 /*SCREEN FOR THE STRONGEST CANDIDATES*/ weekly open is > .01 and Weekly open is < 2 average volume(60) above 100000 and reward is greater than 2.80 /* and draw 5_1wk */ /* and draw loss_1wk on plot 5_1wk */ and do not draw reward /* Sort on best Reward vs Risk */ sort column 9 descending chart-display is weekly chart-length is 13 weeks ---------------------------------- Below is what I get when I run it thru debug. ------------------------------- The following table checks the filter for errors and displays the survivorship match percentages. The percentages are useful in determining which lines are too restrictive. /*MEASURE THE DIFFERENCE FROM WEEKLY OPEN TO WEEKLY HIGH*/ set{whiop, weekly high - weekly open} OK set{Long_Profit, whiop / weekly open } OK /*DETERMINE THE FREQUENCY THAT 5% IS ACHIEVED OVER MULTIPLE TIME FRAMES*/ set{5_1wk, count(Long_Profit > .05,1)} OK set{5_4wk, count(Long_Profit > .05,4)} OK set{5_13wk, count(Long_Profit > .05,13)} OK /*DETERMINE THE FREQUENCY THAT 10% IS ACHIEVED OVER MULTIPLE TIME FRAMES*/ set{10_1wk, count(Long_Profit > .10,1)} OK set{10_4wk, count(Long_Profit > .10,4)} OK set{10_13wk, count(Long_Profit > .10,13)} OK /*APPLY WEIGHTING FACTORS*/ set{var1,5_4wk*0.5} /*WEIGHT 4 WK AVERAGE AT 2X*/ OK set{var2,5_13wk*0.07692} /*WEIGHT 13 WK AVERAGE AT 1X*/ OK set{var3,10_4wk*0.5} /*WEIGHT 4 WK AVERAGE AT 2X*/ OK set{var4,10_13wk*0.07692} /*WEIGHT 13 WK AVERAGE AT 1X*/ OK /*CREATE A WEIGHTED SUMMATION OF STOCK PERFORMANCE (MAX SCORE = 3)*/ Error: Syntax error in filter. set{reward2, var3 + var4} OK /*DETERMINE THE RISK OF TRIPPING A 10% STOP LOSS*/ set{wloss, weekly open - weekly low} OK set{max_loss, wloss / weekly open} OK /*DETERMINE THE FREQUENCY THAT A 10% STOP LOSS IS TRIPPED OVER MULTIPLE TIME FRAMES*/ set{loss_1wk, count(max_loss > .10,1)} OK set{loss_4wk, count(max_loss > .10,4)} OK set{loss_13wk, count(max_loss > .10,13)} OK /*APPLY WEIGHTING FACTORS*/ set{var11,loss_4wk*0.5} /*WEIGHT 4 WK AVERAGE AT 2X*/ OK set{var21,loss_13wk*0.07692} /*WEIGHT 13 WK AVERAGE AT 1X*/ OK /*CREATE A WEIGHTED SUMMATION OF RISK (MAX SCORE = 3)*/ Error: Syntax error in filter. set{performance,reward/risk} OK /* Count Instances where Profit Exceeds 8% */ set{gained_eight_percent, count(Long_Profit > .08 , 1)} OK and draw gained_eight_percent OK 100.0% /* JJO Calculate and display price adjusted volume */ set { Adj_Vol, Volume(60) * close(60) } OK add column Adj_Vol { Dollar Volume} OK 100.0% and add column separator OK 100.0% /* JJO Add Market and Sector information */ and add column exchange OK 100.0% and add column sector OK 100.0% and add column industry OK 100.0% and add column separator OK 100.0% add column performance { Reward/Risk } OK 100.0% add column reward {reward} OK 100.0% add column risk {risk} OK 100.0% add column 5_4wk {5% gain 4 wk} OK 100.0% add column 5_13wk {5% gain 13 wk} OK 100.0% add column separator OK 100.0% add column 10_4wk {10% gain 4 wk} OK 100.0% add column 10_13wk {10% gain 13 wk} OK 100.0% add column loss_4wk {10% stop 4 wk} OK 100.0% add column loss_13wk {10% stop 13 wk} OK 100.0% add column separator OK 100.0% /* for debugging --- var1 + var2 = reward, var11 and var21 = risk */ add column var1 OK 100.0% add column var2 OK 100.0% add column var11 OK 100.0% add column var21 OK 100.0% /*SCREEN FOR THE STRONGEST CANDIDATES*/ weekly open is > .01 and Weekly open is < 2 OK 16.7% average volume(60) above 100000 OK 4.33% and reward is greater than 2.80 OK 0.13% /* and draw 5_1wk */ /* and draw loss_1wk on plot 5_1wk */ and do not draw reward OK 0.13% /* Sort on best Reward vs Risk */ sort column 9 descending OK 0.13% chart-display is weekly OK 0.13% chart-length is 13 weeks OK 0.13% |
compound_gains 222 posts msg #124522 - Ignore compound_gains |
7/24/2015 7:21:00 PM Wow. I'm a firm believer in "keep it simple" because it minimizes curve fitting and a whole bunch of other impediments. No idea of your screen's potential but it seems to me to be pretty complex. JMO and best success to you. |
stockfetcher 980 posts msg #124523 |
7/24/2015 7:26:33 PM Unfortunately, we are having problems following the filter syntax and debug output that you have posted, they do not appear to match. For example, your debug output does not include the definition of 'reward' or 'performance'. Any additional details on how your filter output does not match your syntax will help us understand the problem you are experiencing. StockFetcher Support |
DrJimO 35 posts msg #124525 - Ignore DrJimO |
7/25/2015 8:17:46 AM Reward and Performance are both defined in the filter. The errors shown in Debug are on lines 23 and 40 where reward and risk are set. There is no error on Performance. The debug part of the post is a direct cut and paste of the debug results. The Set lines defining reward and risk both appear in the Debug output as ... Error: Syntax error in filter. ... the cut and paste from debug only captures the text, not the field with the line's code in it. Note that even though debug shows errors on the lines containing reward, var1, var2, risk, var11, and var21, the filter appears to perform correctly and all of these variables show up correctly in columns. Lines 22, 23, 24 read /*CREATE A WEIGHTED SUMMATION OF STOCK PERFORMANCE (MAX SCORE = 3) */ set{reward,var1+var2} set{reward2, var3 + var4} Lines 39, 40, 41 read /*CREATE A WEIGHTED SUMMATION OF RISK (MAX SCORE = 3) */ set{risk,var11+var21} set{performance,reward/risk} Thanks for your help... Jim |
stockfetcher 980 posts msg #124526 |
7/25/2015 9:42:02 AM The warnings you see are false hits and can be corrected by simply adding spaces around the "+" symbol on the two lines in question: ... set{reward,var1 + var2} ... set{risk,var11 + var21} ... StockFetcher Support |
DrJimO 35 posts msg #124527 - Ignore DrJimO |
7/25/2015 10:15:29 AM Well right you are. I never would have expected an idiosyncrasy like that. Adding spaces did fix the debug errors. Is this unique for the + operator. Lines with the * and / operators do not seem to cause any problems. Based on this, I would assume it is good practice in StockFetcher filters to always use a space between operations? Is this true? The other problem I mentioned in the original post had to do with sorting. Third line from the bottom is a sort on column 9. (the reward/risk field). Seems I cannot sort on any column > 8. If I sort on column 8 (Industry), the sort is correct. Can you explain? Jim |
stockfetcher 980 posts msg #124528 |
7/25/2015 11:52:53 AM The issue with the "+" operator also exists with the "-" operator. In both cases, specific operand variable names along with the lack of spaces around the operator will throw a warning in the debugger. The "*" and "/" symbols are not effected as the "+" and "-" can be confused with positive and negative numbers, respectively. Concerning the sort issue, please be sure you are considering the "add column separator" in your counts (e.g. try "sort column 11 descending".) Hope that helps! StockFetcher Support |
DrJimO 35 posts msg #124529 - Ignore DrJimO |
7/25/2015 12:51:01 PM Thanks - that worked. I swear I tried that before, but......... Jim |
DrJimO 35 posts msg #124531 - Ignore DrJimO |
7/25/2015 5:41:44 PM Hey Toad In the process of trying to get my filter working, I found out a few things about the debug function. These were confusing and snagging me constantly, but I think I know what is going on. If you just load a filter into the edit/customize box, when you try to debug it, you get nothing. Seems you need to run the filter first, before you can get any results with debug. This was driving me nuts until I realized it. Also if you make changes, in the customize area, debug doesn't seem to see them until you have saved the filter and run it again. I may not be completely accurate on this, I'm still learning, but if you play around with it, you'll see what I mean. Jim |
StockFetcher Forums · General Discussion · Debugger question | << 1 2 >>Post Follow-up |
Copyright 2022 - 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