sdearle and interested others,
From a post also by me at Equis Forum:
http://forum.equis.com/forums/post/26946.aspx
MS returns a boolean value of 1 or 0 depending on whether a condition can be expressed as true or false, so you dont need the If((AA-Ref(AA,-2)>0),1,0) it can just be written as (AA-Ref(AA,-2))>0 and it will return a value of 1 if this condition is true, 0 otherwise.
Binary values can be added together, e.g.
Code:
ma1:=Mov(C,12,S);
ma2:=Mov(C,33,S);
x:=Cross(ma1,ma2) + (C>10);
{plot}
x;
"x" will take on three possible values:
0 if the Cross() event did not happen AND the price is not greater than 10
1 if either of the Cross() event happened OR the price is greater than 10, but NOT both
2 if both of the Cross() event happened AND the price is greater than 10.
These concepts allow you to write more simple code to deal with more complex situations.
didn't deal with the N/A situations, but these can be easily figured out by looking at a chart with the above function plotted.
So for the RSI exploration: "If(RSI(C,7)<=30,1,0)" with a filter of ColA=1.
There is no need to have this condition in a Column and then refer to that column in the filter. Just put the condition in the filter, remembering that MS will use a binary value of TRUE or FALSE. If you need to see the values of the indicator, then yes, you have to put these in the columns, but leave all the filtering for the filter and leave the columns for displaying data. This also has a significant speed improvement. (if the filter condition is complex, sometimes the Colx function can be be faster but in simple cases it is faster to rewrite the column data in the filter, speed test both cases if speed is an issue)
So, the exploration might look something like:
{column A: RSI}
{only used to display the data in the results table}
RSI(C,7);
{filter}
RSI(C,7)<=30
{load at least 50 bars}
Hope this helps,
wabbit