int[] code=
new int[10000];
int[] year=new int[10000];
int[] month=new int[10000];
int[] day=new int[10000];
int[] oprice=new int[10000];
int[] hprice=new int[10000];
int[] lprice=new int[10000];
int[] cprice=new int[10000];
int[] rprice=new int[10000];
int[] volume=new int[10000];
int tsecode[]=new int[10000];
int tsenumber;
int datanumber;
int ph,pl,pc,po;
int s,c,sx;
int h;
int stock;
int money;
int n,p;
String
file;
public static void main(String [] args) {
pro tset=new pro();
}
pro(){
getcode gc=new getcode();
gc.makedata();
tsecode=gc.tsecode;
tsenumber=gc.tsenumber;
p=0;
for(c=1;c<tsenumber+1;c++){
file="data/"+tsecode[c]+".
txt";
tsedata cd=new tsedata();
cd.makedata(file);
datanumber=cd.datanumber;
hprice=cd.hprice;
lprice=cd.lprice;
oprice=cd.oprice;
cprice=cd.cprice;
rprice=cd.rprice;
year=cd.year;
month=cd.month;
day=cd.day;
volume=cd.volume;
stock=0;
money=10000;
for(s=
100;s<datanumber;s++){
h=0;
if(psy(s,22)<25)h=h+1;
if(cprice[s]>cprice[s-1])h=h+1;
if(stock==0)h=h+1;
if(h==3)stock=money/rprice[s];
if(h==3)money=money-stock*rprice[s];
h=0;
if(psy(s,22)>75)h=h+1;
if(cprice[s]<cprice[s-1])h=h+1;
if(stock>0)h=h+1;
if(h==3)money=money+rprice[s]*stock;
if(h==3)stock=0;
}
money=money+stock*rprice[datanumber];
System.out.
print(tsecode[c]);
System.out.print(",");
System.out.println(money);
p=p+money;
}
p=p/tsenumber;
System.out.println(p);
}
int psy(int s,int num){
int t,tx;
int p1,p2;
int h;
tx=s-num;
h=0;
for(t=tx;t<s;t++){
p1=cprice[t]-cprice[t-1];
if(p1>0)h=h+1;
}
p2=100*h/num;
return p2;
}
}
最終更新:2011年04月16日 20:20