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

Re: Combination analysis & TS



PureBytes Links

Trading Reference Links

> Does somebody knows how can i ask TS2000i to find each possible
> combinations out of 8 differents setups conditions and apply each
> one in a system ? 
> Is there a function code in TS2000i to do  that  ?

No, but you can do it with a bit of trickery.

With 8 separate setups, you will have 2^8 = 256 different 
combinations to test.  255, actually, since you're probably not 
interested in the case of NO setups.  

You can just loop from 1 to 255 and determine which bits are 
turned on in an integer representation of your counter.  If bit 0 
is turned on, include setup 0.  If bit 1 is turned on, include 
setup 1, etc.

In TS2k there are no integer variables, but you can approximate 
it with floating-point values.  Let's say you use a function like 
this:

        { Boolean function BitNOn }

        { Returns True if the 2^N bit in a numeric value is on. }
        { Rightmost bit is N = 0.                               }
        			
        input:  IntVal(numeric), N(numeric);

        BitNOn = mod(IntPortion(IntVal / Power(2, N)), 2) = 1;

Then you could code your test something like this:

input: TestNumber(0);

if BitNOn(TestNumber, 0) then TestSetup0;
if BitNOn(TestNumber, 1) then TestSetup1;
if BitNOn(TestNumber, 2) then TestSetup2;
if BitNOn(TestNumber, 3) then TestSetup3;
if BitNOn(TestNumber, 4) then TestSetup4;
if BitNOn(TestNumber, 5) then TestSetup5;
if BitNOn(TestNumber, 6) then TestSetup6;
if BitNOn(TestNumber, 7) then TestSetup7;

Run an optimization of TestNumber from 1 to 255.
Gary