var state='A';
var currentPrice;
var lastBuyPrice;
for (i=0;i<365;i++) {
 switch (state) {
  case 'A':
   if (true) {
    firstBuy(15000);
    lastBuyPrice=currentPrice;
    state='B';
   }
   break;
  case 'B':
   if (lastBuyPrice>currentPrice*1.4) {
    secondBuy(20000);
    lastBuyPrice=currentPrice;
    state='C';
   }
   break;
  case 'C':
   if (lastBuyPrice>currentPrice*1.4) {
    thirdBuy(40000);
    state='D';
   }
   break;
  case 'D':
   if (lastBuyPrice>currentPrice*1.4) {
    fourthBuy(80000);
    state='Z';
   }
   break;
  default:
   break;
 }
}

abort 發表在 痞客邦 PIXNET 留言(0) 人氣()