예제 #1
0
        public void loopVariavel(ICaller caller, int id)
        {
            Variavel v = tradeSystem.vm.GetVariavel(id);

            v.reset();
            while (!v.hasEnded())
            {
                Utils.Info("loop da variavel " + v.name + " com vlr:" + v.vlrAtual);

                if (id + 1 < tradeSystem.vm.Count)
                {
                    loopVariavel(caller, id + 1);
                }
                else
                {
                    countLoops_++;
                    runMonteCarlo(caller, getVarsValues());
                }

                v.next();


                //runSingleBackTest();
            }
        }
예제 #2
0
        public void TestVariaveis()
        {
            Config          config      = new Config();
            TradeSystem     tradeSystem = new TradeSystem(config);
            VariavelManager vm          = tradeSystem.vm;
            string          na          = "VAR1";
            string          nb          = "NOME_QUALQUER";
            Variavel        va          = vm.GetVariavel(na, "", 1, 2, 3);
            Variavel        vb          = vm.GetVariavel(nb, "", 10, 3, 30);

            string text = "%" + na + "%>%" + nb + "%";

            Assert.IsTrue(vm.ReplaceVariavel(text) == "1>10", "Erro: " + vm.ReplaceVariavel(text));
            va.next();
            vb.next();
            float vna = va.vlrAtual;
            float vnb = vb.vlrAtual;

            Assert.IsTrue(vm.ReplaceVariavel(text) == vna + ">" + vnb, "Erro: " + vm.ReplaceVariavel(text));

            text = "%" + na + "%%" + nb + "%";
            Assert.IsTrue(vm.ReplaceVariavel(text) == vna + "" + vnb, "Erro: " + vm.ReplaceVariavel(text));
        }