I am working on a strategy the combines several different indicators. The values of these indicators had been separately optimized for specific market conditions, generating distinct data-sets.

I need a combinatorial programming solution in order to call each data-set when triggered.

Currently, my solution looks as follows:

// --------------

protected override void OnBarUpdate()

{

if (CurrentBar < BarsRequired) return;

if (ToTime(Time[0]) >= ToTime(t1, 00, 0) && ToTime(Time[0]) <= ToTime(t2, 00, 0))

{p1 = true; p2 = true; p3 = true; // bool flags

if (p1)

{ds1 = 1; // data-set 1

if (ds1 == 1)

{x = 6; y = 4; z = 2; a = -2; b = 6; c = -4;

{

if (Indicator 1 <= x

&& Indicator 2 <= y

&& Indicator 3 <= z

&& Indicator 4 <= a

&& Indicator 5 <= b)

{w1 = 1; // int flag

}}}}

if (p2)

{ds2 = 1; // data-set 2

if (ds2 == 1)

{x = 1; y = 5; z = 9; a = -1; b = 0; c = -12;

{

if (Indicator 1 <= x

&& Indicator 2 <= y

&& Indicator 3 <= z

&& Indicator 4 <= a

&& Indicator 5 <= b)

{w2 = 1; // int flag

}}}}

if (p3)

{ds3 = 1; // data-set 3

if (ds3 == 1)

{x = 4; y = 0; z = 11; a = 8; b = -2; c = 3;

{

if (Indicator 1 <= x

&& Indicator 2 <= y

&& Indicator 3 <= z

&& Indicator 4 <= a

&& Indicator 5 <= b)

{w3 = 1; // int flag

}}}}

}

if (w1 + w2 + w3 >= 1)

{signalBar1 = CurrentBar; cond1 = true;

w1 = 0; w2 = 0; w3 = 0;

}

if (cond1 && CurrentBar == signalBar1 // bool flags

&& Position.MarketPosition == MarketPosition.Flat)

{EnterLong("Long 1a");

SetStopLoss("Long 1a", CalculationMode.Ticks, sL1, false);

if (BarsSinceEntry() == bseL1) cond1 = false;

}

etc ....

// --------------------

As this scheme may be further extended with additional data-sets,

I am looking for a different solution, where a single list of indicators is able to call many data-sets separately.

Thanks much,

bkool

## Comment