アットウィキロゴ

xxc

class pro{

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;

money=10000;
stock=0;

for(s=100;s<datanumber;s++){
h=0;
if(stock==0)h=h+1;
if(rsi(s)<25)h=h+1;
if(money>100000000)h=0;
if(h==2)stock=money/rprice[s];
if(h==2)money=money-stock*rprice[s];
h=0;
if(stock>0)h=h+1;
if(rsi(s)>75)h=h+1;
if(h==2)money=money+stock*rprice[s];
if(h==2)stock=0;
}
money=money+stock*rprice[datanumber];
System.out.println(c);
System.out.println(money);
p=p+money;
}
System.out.println(p/tsenumber);
}


int rsi(int s){
int t,tx;
int px,p1,p2;
int rs;
tx=s-14;
p1=1;
p2=1;
for(t=tx;t<s+1;t++){
px=cprice[t]-cprice[t-1];
if(px>0)p1=p1+px;
if(px<0)p2=p2-px;
}
rs=100*p1/(p1+p2);
return rs;
}




}
最終更新:2011年04月17日 15:49