djones000buck 206 posts msg #96785 - Ignore djones000buck |
10/6/2010 5:59:02 PM
Working on my SF coding skills a bit lately and am having trouble with the following filter. Pieced together and built with some references/terminology from other filters (thanks to you if any of it seems familiar).
What I was attempting to do was build a filter that would report statistics on the occurrence of a trigger from the close of stocks price high 1, 2, and 3 days after the occurrence of the trigger. The version i show below looks at rsi(2) and defines a trigger as an increase of rsi(2) greater than 35. Then reports back the number of times the stocks high the following 3 days gained 1,2,and 3 percent from the trigger day's close.
Then by changing the top two sections of the code for the triggers, you could apply the statistics to any trigger you wanted to use (ie a moving average crossover)
So here is the filter:.
The problem I am having is in the 5th and 6th variables that I have for each percent (1,2, &3) right here:
/*sum up 1pct percentage triggers for one occurrence in 3days*/
set{1ptvar1, count(1pt2a one day ago > .9,1)}
set{1ptvar2, count(1pt1a two days ago > .9,1)}
set{1ptvar3, 1pt3a + 1ptvar1}
set{1ptvar4, 1ptvar3 + 1ptvar2}
/*set{1ptvar5, count(1ptvar4 > .9,1)} */
/*set{1ptvar6, count(1ptvar4 > .9,100)} */
As it is the filter reports the statistics on the stock making the percentages that are defined for each 1 2 and 3 days after the trigger... So if 1ptvar4 is 1 that means that one of the three days after the trigger occurred, the stocks high price reached 1% or greater than the trigger days close. If 1ptvar4 is 2, the stock made one percent 2 of the 3 days after the trigger, and if 1ptvar4 is 3, then the stock made one percent 3 of 3 days after the close.
So to complete the filter, what I am attempting to do is define statistically that if 1ptvar4 is greater than 1, then count it as one occurrence to apply towards the statistics..
Sorry if I reinvented the wheel, but I am stumped and can't figure out the error when I activate any of the 5th or 6th variables for each percentage...
If I left out any info please feel free to let me know... Thanks!
It might look a bit complicated and long, which wouldn't suprise me that there is an easier way to do this.... :-)
|