[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Multiple filter optimisation



PureBytes Links

Trading Reference Links

Ian:
> I have a system that includes several filters such as:
>
> cond1=adx>adx[1]
> cond2=h>h[1]
> cond3=mom>mom[1]
> cond4=
> cond5=
>
> and so on.

...and you want to test all combinations, cond1+cond2, cond1+cond4+cond5,
etc.

This is easy to do.  All you need to do is have a switch parameter for
each condition.  In the optimization, the start value for each switch is
0, the end value is 1, and the increment is 1.  So each switch will have
the values 0 or 1 during the optimization.

Then in your strategy, you use those switches to include or ignore the
associated conditions.  i.e.

combined_condition = iff(switch1=1, cond1, true);
combined_condition = combined_condition and iff(switch2=1, cond2, true);
combined_condition = combined_condition and iff(switch3=1, cond3, true);
combined_condition = combined_condition and iff(switch4=1, cond4, true);
combined_condition = combined_condition and iff(switch5=1, cond5, true);
...and so on.

The final result of combined_condition will be true if ALL of the
conditions that were switched on (switchX=1) are true.  combined_condition
will be false if any of the switched-on conditions are false.

-Alex