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

Re: [amibroker] OT: random combinations



PureBytes Links

Trading Reference Links

Hi Anthony,
 
Sorry for the delay in responding - I got caught up in the new beta. It appears that you are trying to find the combos that fit between your upper and lower limits? If that is the case, I think I see 2 problems:
 
1. I don't think you can do this by selecting n=10. The code will execute start to finish for each of the 10 days, yeilding the same results for each day in your case. I think you could do it by putting your Addcolumns inside a loop (if you really like scrolling   8 - ) but it would probably be better to use the interpretation window - I have used it in the past to create tables of statistics and it worked pretty good.
 
2. Either way, code would need to be modified - I might be able to work with you a bit in my spare time - let me know if you are interested in pursuing it.
 
Steve
----- Original Message -----
Sent: Friday, October 21, 2005 11:40 PM
Subject: Re: [amibroker] OT: random combinations

Steve,
 
Thanks for taking a look...
 
The output should look like this:
 
combination 1........ 1...2...22...34...35...36
combination 2.........1...2...23...33...35...36
combination 3.........1...2...24...32...35...36
combination 4.........1...2...24...33...34...36
combination 5.........1...2...25...31...35...36
combination 6.........1...2...25...32...34...36
combination 7.........1...2...25...33...34...35
combination 8.........1...2...26...30...35...36
combination 9.........1...2...26...31...34...36
etc......
 
the looping is controlled / referencing the size parameter....each of the combinations are controlled by the upper and lower limits...in this case I set the upper and lower limit to 130...so each combination will add up to 130...
----- Original Message -----
Sent: Friday, October 21, 2005 9:27 PM
Subject: Re: [amibroker] OT: random combinations

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





SPONSORED LINKS
Investment management software Real estate investment software Investment property software
Software support Real estate investment analysis software Investment software


YAHOO! GROUPS LINKS