Please Help me to improve my Exploration Code

/*

Hello, friends if any of you can help me by solving the following situation then it will be a great help for me.
I learned a bit of AFL coding from here and there over internet ------ just by guessing and trial & error method.
Now I am stucked and don't know how to solve. I asked for help in many Forums and Communities but no success. Please help.
Following is the case and code in which I need your help.

The Indicator I am using is MACD ( Moving Average Convergence Divergence ).
When MACD and Signal both are above the 0 level and MACD is above the Signal we assign such a condition as "xMACD_Up".
When MACD and Signal both are below the 0 level and MACD is below the Signal we assign such a condition as "xMACD_Down".

Now we also have an exploration for these two conditions.
And also an exploration for a crossover between xMACD and the Signal.

Once a crossover between MACD and Signal happens after any of these two conditions,
then for me its an indication that for the time being price may not have a genuine force behind it to continue in the same direction.
So after that I do not want to follow the price here and would like to look for another chart where such a case is not present yet.

In other words, xMACD_UP is invalidated when a crossover between MACD and Signal happens,
and xMACD_Down is invalidated when when a crossover between MACD and Signal happens.

Right now I have a the exploration for xMACD_up and xMACD_Down conditions and for crossover also.
And together these explorations make a very-very big result list. (Just run the exploration and see the size of resulting list.)

So, in order to make the list small, I don't want to see the kind of results in exploration where any of these two conditions are followed by a crossover .

In other words, if a filter for their Invalidation (--which is appearance of crossover after them---) is added in the exploration,
then the resulting list from exploration will be much samller.
And thereby we will not be in unnecessary need for searching only those results in the list which are usable out of unusable.

Thanks...

*/

//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

_SECTION_BEGIN("xMACD");


Fast_EMA = 12;   // Default value of MACD Indicator.
Slow_EMA = 26;   // Default value of MACD Indicator.
Signal_EMA = 9;  // Default value of MACD Indicator.

xMACD = EMA( C, Fast_EMA ) - EMA(C , Slow_EMA );
xSignal  = EMA ( xMACD, Signal_EMA );
xHistogram   = xMACD - xSignal;

_SECTION_END();

//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx


_SECTION_BEGIN("Crossover");

Crossover_Positive = Cross( xMACD, xSignal ); 
Crossover_Negative = Cross( xSignal, xMACD );

Crossover_Up_Positive = Crossover_Positive AND xMACD >= 0;
Crossover_Up_Negative = Crossover_Negative AND xMACD >= 0 ;

Crossover_Down_Positive = Crossover_Positive AND xMACD <= 0;
Crossover_Down_Negative = Crossover_Negative  AND XMACD <= 0;


Crossover_Up_Type = Crossover_Up_Positive OR Crossover_Up_Negative; 
Crossover_Down_Type = Crossover_Down_Positive OR Crossover_Down_Negative;


_SECTION_END();

//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

_SECTION_BEGIN("xMACD Up-&-Down");

xMACD_Up = xMACD > xSignal AND xMACD > Ref( xMACD,-1 ) AND xMACD > 0 AND xSignal > 0;
xMACD_Down = xMACD < xSignal AND xMACD < Ref( xMACD,-1 ) AND xMACD < 0 AND xSignal < 0;

xMACD_Up = ExRem( xMACD_Up, xMACD_Down );
xMACD_Down = ExRem( xMACD_Down, xMACD_Up );

_SECTION_END();

//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

_SECTION_BEGIN("xMACD Up-&-Down Invalided");

xMACD_Up_Invalided =  Crossover_Up_Type;
xMACD_Down_Invalided = Crossover_Down_Type;

xMACD_Up_Invalided = ExRem(xMACD_Up_Invalided, xMACD_Down_Invalided);
xMACD_Down_Invalided = ExRem(xMACD_Down_Invalided, xMACD_Up_Invalided);

_SECTION_END();

//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

_SECTION_BEGIN( "Exploration" );

xMACD_Exploration = xMACD_Up OR xMACD_Down;

xMACD_UpDown_Invalided_Exploration = xMACD_Up_Invalided OR xMACD_Down_Invalided;


Filter = xMACD_Exploration OR xMACD_UpDown_Invalided_Exploration;


AddRankColumn();

AddColumn( IIf( xMACD_Exploration == xMACD_Up, xMACD_Up, Null ), "MACD-Up", 1.0, colorWhite, colorGreen );
AddColumn( IIf( xMACD_Exploration == xMACD_Down, xMACD_Down, Null ), "MACD-Down", 1.0, colorWhite, colorRed );

AddColumn( IIf( xMACD_UpDown_Invalided_Exploration == xMACD_Up_Invalided, xMACD_Up_Invalided, Null ), "xMACD-Up Invalided", 1.0, colorWhite, colorDarkGreen );
AddColumn( IIf( xMACD_UpDown_Invalided_Exploration ==  xMACD_Down_Invalided,  xMACD_Down_Invalided, Null ), "xMACD-Down Invalided", 1.0, colorWhite, colorDarkRed );


 _SECTION_END();

//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx