Esempio n. 1
0
        protected void checkEnterOrderCompleted(Series <DateTime, MarketDataElement> series)
        {
            if (!execution.isPositionEmptySignalOnClose())
            {
                return;
            }
            lastExecutePrice = execution.getFilledPrice();
            lastSignalPrice  = execution.getSignalPriceForExecution();
            log.Info("[Strategy] : Enter Strategy Executed!!!");
            log.Info("[Strategy] : Exit Strategy Executed!!!");
            int index = execution.getIndexClosedAppOrder();

            if (index == 1)
            {
                log.Info("Executed Rule = " + execution.PendingOrder1.TriggerRule);
                log.Info("Executed Rule Remark = " + execution.PendingOrder1.Remark);
            }
            else
            {
                log.Info("Executed Rule = " + execution.PendingOrder2.TriggerRule);
                log.Info("Executed Rule Remark = " + execution.PendingOrder2.Remark);
            }
            log.Info("******************************************************************");
            String dir = execution.getCompleteSignalSide();

            execution.completePendingSignal();
            execution.flushCompletSignal();
            immediateOrderEnter = true;
        }
        public void test_GetCompleteSignalSide_Positive()
        {
            ISignalContext context = new SignalContext();

            context.setPendingSignal1(AppConstant.BUY_SIGNAL, 20000, createOrder_Buy1Contract_1Complete(), "Buy Order");
            context.setPendingSignal2(AppConstant.SELL_SIGNAL, 22000, createOrder_Sell1Contract_0Complete(), "Sell Order");
            Assert.AreEqual(AppConstant.BUY_SIGNAL, context.getCompleteSignalSide());

            context = new SignalContext();
            context.setPendingSignal1(AppConstant.BUY_SIGNAL, 20000, createOrder_Buy1Contract_0Complete(), "Buy Order");
            context.setPendingSignal2(AppConstant.SELL_SIGNAL, 22000, createOrder_Sell1Contract_1Complete(), "Sell Order");
            Assert.AreEqual(AppConstant.SELL_SIGNAL, context.getCompleteSignalSide());

            context = new SignalContext();
            context.setPendingSignal1(AppConstant.SELL_SIGNAL, 22000, createOrder_Sell1Contract_0Complete(), "Buy Order");
            context.setPendingSignal2(AppConstant.BUY_SIGNAL, 20000, createOrder_10Contract_10Complete(), "Sell Order");
            Assert.AreEqual(AppConstant.BUY_SIGNAL, context.getCompleteSignalSide());
        }