コード例 #1
0
        public LiqInjT(QREBridgeBase bridge, Symbol symbol) : base(bridge, symbol)
        {
            beta      = symbol.relatedPrefix("LIB" + "10").doubles(bars);
            betaShort = symbol.relatedPrefix("LIO" + "10").doubles(bars);
            residual  = symbol.relatedPrefix("LIV" + "10").doubles(bars);
            zScore    = symbol.relatedPrefix("LIZ" + "10").doubles(bars, 0);
            tc        = symbol.relatedPrefix("LIC" + "10").doublesNoLive(bars);
            acf       = new EWAcf(zScore, parameter <double>("acfHalfLife"), parameter <int>("acfLag"));

            zScoreMin       = parameter <double>("zScoreMin");
            pScoreMin       = parameter <double>("pScoreMin");
            betaMin         = parameter <double>("betaMin");
            betaMax         = parameter <double>("betaMax");
            acfTrigger      = parameter <double>("acfTrigger");
            risk            = parameter <long>("risk");
            stopMultiple    = parameter <double>("stopMultiple");
            targetNetProfit = stopMultiple * risk;
        }
コード例 #2
0
ファイル: LiqInj.cs プロジェクト: TzarIvan/ratel
        public LiqInj(QREBridgeBase bridge, Symbol symbol) : base(bridge, symbol)
        {
            version  = symbol.name.Substring(3, 2);
            residual = symbol.relatedPrefix("PTV" + version).doubles(bars);
            tc       = symbol.relatedPrefix("PTC" + version).doublesNoLive(bars);
            rSquare  = symbol.relatedPrefix("PTR" + version).doubles(bars);
            hedge    = symbol.relatedPrefix("PTH" + version).doubles(bars);
            scale    = symbol.relatedPrefix("PTS" + version).doublesNoLive(bars, 0);
            var atrLength = parameter <int>("ATRLength");

            nATR = parameter <double>("nATR");
            if (nATR != 0 && atrLength != 0)
            {
                atr = new AverageTrueRange(bars, atrLength);
            }
            zScore = symbol.relatedPrefix("PTZ" + version).doubles(bars, 0);
            acf    = new EWAcf(zScore, parameter <double>("acfHalfLife"), parameter <int>("acfLag"));

            zScoreMin              = parameter <double>("zScoreMin");
            pScoreMin              = parameter <double>("pScoreMin");
            rSquareMin             = parameter <double>("rSquareMin");
            hedgeSwitch            = parameter <int>("hedgeSwitch");
            hedgeMin               = parameter <double>("hedgeMin");
            hedgeMax               = parameter <double>("hedgeMax");
            acfTrigger             = parameter <double>("acfTrigger");
            scaleMin               = parameter <double>("scaleMin");
            startSize              = parameter <long>("startSize");
            stopMultiple           = parameter <double>("stopMultiple");
            bridge.manager.onLive += () => {
                if (startOfDayPosition != null)
                {
                    livePosition = startOfDayPosition;
                }
                if (startOfDayTargetNetProfit.HasValue)
                {
                    liveTargetNetProfit = startOfDayTargetNetProfit;
                }
            };
            addToPlot(zScore, "zScore", Color.Red, "zScore");
        }