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

Re: [amibroker] OT: random combinations



PureBytes Links

Trading Reference Links

Hi again Anthony,
 
I got interested in your code so I popped it into AB. I haven't figured out what you are trying to do, but I tweaked the syntax to make it like I *think* you intended it. I don't think it will give the results you are expecting though - since you don't reference any type of data, it just behaves the same for each of the 10 days. Could you provide a little more detail?
 
Steve
 
upperlimit=Param("upperlimit sum",130,75,130,1);
Lowerlimit=Param("lowerlimit sum",130,75,130,1);
size=Param("size",36,36,55,1);
a=0;b=0;Cc=0;d=0;e=0;f=0;Ctr=0;
 
for (a = 1; a < size-5; a++)
 for (b = a+1; b < size -4; b++)
  for (Cc = b+1; Cc < size -3; Cc++)
   for (d = Cc+1; d < size -2; d++)
    for (e = d+1; e < size -1; e++)
     for (f = e+1; f < size; f++)
     {
      Summ = a + b + Cc + d + e + f;
      if(Summ <= Lowerlimit AND Summ >= upperlimit)
       Ctr= Ctr+1;
     }
 
Filter=1;
AddTextColumn(WriteIf(Ctr >0,"Combination ","")+Ctr,"ctr",1);
AddColumn(a,"a",1);
AddColumn(b,"b",1);
AddColumn(Cc,"c",1);
AddColumn(d,"d",1);
AddColumn(e,"e",1);
AddColumn(f,"f",1);
AddColumn(Summ,"sum",1);
----- Original Message -----
Sent: Friday, October 21, 2005 8:22 PM
Subject: [amibroker] OT: random combinations

Could someone look at this ....
my settings in AA window are as follows:
current ticker
n last quotations
n=10
 
When I click explore I am expecting the output to have 10 different combinations with the combinations equaling 130 ...
 
Thank you in advance
Anthony
 

upperlimit=Param("upperlimit sum",130,75,130,1);

Lowerlimit=Param("lowerlimit sum",130,75,130,1);

size=Param("size",36,36,55,1);

a=0;b=0;Cc=0;d=0;e=0;f=0;Ctr=0;

for (a = 1; a < size-5; a++);

for (b = a+1; b < size -4; b++);

for (Cc = b+1; Cc < size -3; Cc++);

for (d = Cc+1; d < size -2; d++);

for (e = d+1; e < size -1; e++);

for (f = e+1; f < size; f++);

Summ=a + b + Cc + d + e + f;

 

if(Summ <= Lowerlimit AND Summ >= upperlimit );

{

Ctr= Ctr+1;

}

Filter=1;

AddTextColumn(WriteIf(Ctr >0,"Combination ","")+Ctr,"ctr",1);

AddColumn(a,"a",1);

AddColumn(b,"b",1);

AddColumn(Cc,"c",1);

AddColumn(d,"d",1);

AddColumn(e,"e",1);

AddColumn(f,"f",1);

AddColumn(Summ,"sum",1);



Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com

For other support material please check also:
http://www.amibroker.com/support.html





YAHOO! GROUPS LINKS