public static void main(String[] args)throws IOException 
    {        
        double finalAnswer=-99999;
        double finalcurvePoints=0;
        double finalPeriod=0;
        double finalPercDif=0;
        double finalminSRDif=0;
        double finalTP=0;
        double[] PortfolioValue=new double[60*260];
        double[] BaseValue=new double[60*260];
        final XYSeriesCollection dataset = new XYSeriesCollection();
        
        for(int curvePoints =10;curvePoints<=10;curvePoints++){                 //4
            for(int period=10;period<=10;period++){                             //2
                for(int difPercenti=34;difPercenti<=34;difPercenti++){          //28
                    for(int minSRDif=37;minSRDif<=37;minSRDif++){               //34
                        for(int TPi=14;TPi<=14;TPi++){                          //32
                            
                            double difPercent=(double)difPercenti/100;
                            double minSRDifin=(double)minSRDif/1000;
                            double TP=(double)TPi/1000;
                            double answer=OptimiseParameters(minSRDifin,curvePoints,period,difPercent, TP,PortfolioValue,BaseValue,dataset);
                            System.err.println(answer);
                            if(finalAnswer<answer){
                                finalminSRDif=minSRDifin;
                                finalAnswer=answer;
                                finalcurvePoints=curvePoints;
                                finalPeriod=period;
                                finalPercDif=difPercent;
                                finalTP=TP;
                            }
                        }
                    }
                }
            }
        }
        
        System.out.println("The best parameters are : ");
        System.out.println("period : "+finalPeriod);
        System.out.println("curvePoints : "+finalcurvePoints);
        System.out.println("PercentDifferenceNeeded : "+finalPercDif);
        System.out.println("finalminSRDif : "+finalminSRDif);
        System.out.println("TP : "+finalTP);
        System.out.println("The best effective annual return for these parameters is : "+finalAnswer);
        
        

    }