Hi Markus --
When the relationship between the two moving average lengths changes, the
system changes from being a trend following system to being a mean reversion
system. It remains a "long" system when the signals generated are Buy =
cross(MA1,MA2); It becomes a "short" system when the signals generated are
Short = cross(MA1,MA2);
Why exclude them? You may very well find that the system works best as a
mean reversion system.
But if you insist on limiting the variables, try this:
//////////////////////////////////
MA1Length = Optimize("MA1Length",50,50,200,1);
MA2Length = Optimize("MA2Length",100,100,300,1);
MA1 = MA(C,MA1Length);
MA2 = MA(C,MA2Length);
// Generate a Buy signal when MA1 crosses up through MA2,
// but only when the length of MA1 is less than the length of MA2
Buy = (MA1Length<MA2Length) AND Cross(MA1,MA2);
Sell = Cross(MA2,MA1);
///////////////////////////////////
Thanks,
Howard
On Wed, Jan 6, 2010 at 5:44 AM, Markus Witzler <[email protected]> wrote:
>
>
> Hello,
>
> let´s say I intend to optimize a 2 MA crossover system with MA1 and MA2.
>
> Possible range for MA1: 50-200
> Possible range for MA2: 100-300
>
> Now, there are some instances in which periodicity of MA1 is higher than
> the one of MA2, thereby creating a "short" system.
>
> How does one exclude these "redundant" combinations from optimization?
>
> Thanks
>
> Markus
>
>