Esempio n. 1
0
        public override void OnStrategyStart()
        {
            base.OnStrategyStart();

            //测试用,自定义交易时间,只使用日线做简单测试时极方便
            base.TimeHelper = new TimeHelper(new int[] { 0, 2400 }, 2100, 1700);
            // 此处要测试是否支持交易所组合合约
            base.TextParameter = new TextSP();

            base.TargetPosition         = 0;
            base.DualPosition.Long.Qty  = 0;
            base.DualPosition.Short.Qty = 0;

            // 记下策略的对象,在其它实例中可以用到
            //Global.Add(Instrument.Symbol, this);

            if (Instrument.Symbol == Symbol1)
            {
                S1 = this;
            }
            if (Instrument.Symbol == Symbol2)
            {
                S2 = this;
            }

            fastSMA = new SMA(Bars, fastLength, Color.Red);
            slowSMA = new SMA(Bars, slowLength, Color.Green);

            Draw(fastSMA, 0);
            Draw(slowSMA, 0);
        }
Esempio n. 2
0
        public override void OnStrategyStart()
        {
            base.OnStrategyStart();

            //测试用,自定义交易时间,只使用日线做简单测试时极方便
            base.TimeHelper = new TimeHelper(new int[] { 0, 2400 }, 2100,1700);
            // 此处要测试是否支持交易所组合合约
            base.TextParameter = new TextSP();

            base.TargetPosition = 0;
            base.DualPosition.Long.Qty = 0;
            base.DualPosition.Short.Qty = 0;

            // 记下策略的对象,在其它实例中可以用到
            //Global.Add(Instrument.Symbol, this);

            if (Instrument.Symbol == Symbol1)
            {
                S1 = this;
            }
            if (Instrument.Symbol == Symbol2)
            {
                S2 = this;
            }

            fastSMA = new SMA(Bars, fastLength, Color.Red);
            slowSMA = new SMA(Bars, slowLength, Color.Green);

            Draw(fastSMA, 0);
            Draw(slowSMA, 0);
        }