public static double[] takePosition(int day,double[] bestParams,String fileName,int lineNumber,double[] Prices,double money,double shares){
        
        
        double longAve =0;
        double shortAve =0;
        for(int i=day-(int)bestParams[0];i<day;i++){longAve=longAve+Prices[i];}
        for(int i=day-(int)bestParams[1];i<day;i++){shortAve=shortAve+Prices[i];}
        longAve=longAve/bestParams[0];
        shortAve=shortAve/bestParams[1];
        double currentValue=Prices[day];
        double dif=longAve-shortAve;
        double currentDifNeeded=(0.5/100)*Prices[day];
        double TradePercent=0.2;
        if( Math.abs(dif)<Math.abs(currentDifNeeded)){
            if(dif>0){
               shares=shares + ((money*TradePercent)-(money*TradePercent*0.002))/Prices[day];
               money = money - money*TradePercent ;
            }
            if(dif<0){
               money = money + shares*TradePercent*Prices[day] -(shares*TradePercent*Prices[day]*0.002);
               shares=shares-shares*TradePercent ;                                           
            }
        }
        double[] answer=new double[3];
        answer[0]=money;
        answer[1]=shares;
        answer[2]=Prices[day];
        return answer;
    }