コード例 #1
0
        public BackTest(BackTestConfiguration _config)
        {
            //set internal vars

            runLength        = _config.runLength;
            maxTradesPerDay  = _config.maxTradesPerDay;
            currencyPair     = _config.currencyPair;
            timeFrame        = _config.timeFrame;
            riskPercent      = _config.riskPercent;
            riskVsReward     = _config.riskVsReward;
            startingBalance  = _config.startingBalance;
            startDate        = _config.startDate;
            connectionString = _config.connectionString;
            //initialize defaults

            profitTrades = default;
            lossTrades   = default;
            totalTrades  = default;
            trade        = default;

            closingPrice      = new List <double>();
            myAccountSettings = new AccountSettings {
                BASEURI = BASEURI, APIKEY = APIKEY, ID = ID
            };

            myAccount   = new AccountAccessor(myAccountSettings);
            instruments = new InstrumentAccessor(myAccountSettings, currencyPair);


            orders = new OrderAccessor(myAccountSettings);
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: johnmcmahonart/PennyRoyal
        private static void BackTest()
        {
            BackTestConfiguration backTestConfiguration = new BackTestConfiguration
            {
                logFile          = "BackTestLog",
                currencyPair     = "EUR_USD",
                timeFrame        = "M1",
                riskPercent      = .025M,
                riskVsReward     = 1.25M,
                maxTradesPerDay  = 2,
                startingBalance  = 1000.00M,
                startDate        = new DateTime(2010, 1, 1),
                runLength        = 2995,
                connectionString = @"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=c:\pennyroyaldb\EUR_USD.mdf;Integrated Security=True"
            };

            BackTest backTest = new BackTest(backTestConfiguration);

            //backTest.StoreData(new string[] { "M1","M2","M4","M5","M10","M15"});
            backTest.Reset(new string[] { "SimpleTrendFollowings" });
            backTest.Run("SimpleTrendFollowing", new string[] { "M1", "M2", "M4", "M5", "M10" });
            Environment.Exit(0);
        }