public static void RunSignalProportionVolTargetted_BondFutures(bool persist_, bool zScoreIsFromMean_ = false, double scoreShift_ = 0.1)
    {
      var name = BondFutures_SignalProportionVolTargetted;
      var args = getBaseFuturesTraderArgs(x => x.AssetClass.Equals("Fixed Income") && (x.Country.Equals("US") || x.Country.Equals("Germany")));
      args.DayOffset = 0;

      args.WtIndicators.Add(new Multi_NPeriodMomentum_SharpeFilter_Fade()
      {
        ZScoreIsFromMean = zScoreIsFromMean_,
        ScoreShift = scoreShift_
      });
      args.ScaleToVol = false;

      {
        var valWt = new Backtest.Builder.Model.WtScheme();
        valWt.ValueWt.Enabled = true;
        args.WtIndicators[0].TransformList.Add(valWt);
      }

      var trader = Singleton<Backtest.TraderGen>.Instance;
      var fullStrengthVolTarget = 0.06;

      // get the raw weights (unscaled)
      var wts = trader.GetWeights(args);

      Dictionary<DateTime, double> dailyVolTargets = new Dictionary<DateTime, double>();

      // scale each day
      foreach (var date in wts.Dates)
      {
        var dayWts = wts.GetValues(date);

        var numNonZero = dayWts.Where(x => Math.Abs(x) > 1e-07).ToArray();

        if (numNonZero.Length == 0) continue;

        var dayStrength = numNonZero.SumAbs();

        var proportion = dayStrength / Convert.ToDouble(numNonZero.Length);

        dailyVolTargets.Add(date, proportion * fullStrengthVolTarget);
      }

      wts = Backtest.TraderGen.DoScaleWeights(wts, args, x => dailyVolTargets[x]);

      var pnl = trader.DoPnl(args, wts);

      if (persist_)
        persistResult(name, wts, pnl);
      else
        pnl.Display(name + zScoreIsFromMean_);
    }
    public static void RunSignalProportionVolTargetted_FX(bool persist_, bool zScoreIsFromMean_ = false, double scoreShift_ = 0.1)
    {
      var name = FX_SignalProportionVolTargetted;

      var args = getBaseFXTraderArgs();
      args.DayOffset = 0;

      args.WtIndicators.Add(new Multi_NPeriodMomentum_SharpeFilter_Fade()
      {
        ZScoreIsFromMean = zScoreIsFromMean_,
        ScoreShift = scoreShift_
      });
      args.ScaleToVol = false;

      {
        var valWt = new Backtest.Builder.Model.WtScheme();
        valWt.ValueWt.Enabled = true;
        args.WtIndicators[0].TransformList.Add(valWt);
      }

      var trader = Singleton<Backtest.TraderFX>.Instance;
      var fullStrengthVolTarget = 0.06;

      // get the raw weights (unscaled)
      var wts = trader.GetWeights(args);

      // scale each day
      foreach (var date in wts.Dates)
      {
        var dayWts = wts.GetValues(date);

        var numNonZero = dayWts.Where(x => Math.Abs(x) > 1e-07).ToArray();

        if (numNonZero.Length == 0) continue;

        var dayStrength = numNonZero.SumAbs();

        var proportion = dayStrength / Convert.ToDouble(numNonZero.Length);

        var cov = Singleton<SI.Data.ComCovarianceSource>.Instance.GetCovarianceForDateElesePrevious(date, 45);

        if (cov == null)
        {
          if (date.Year < 2002)
          {
            cov =
              Singleton<SI.Data.CovarianceSource>.Instance.GetCovarianceForDateElesePrevious(new DateTime(2002, 1, 2));
          }
        }

        var scaledWts = Backtest.TraderFX.weightFX(dayWts, cov, args, proportion*fullStrengthVolTarget);

        wts.SetValues(date, scaledWts);
      }

      var pnl = trader.DoPnl(args, wts);

      if(persist_)
        persistResult(name, wts, pnl);
      else
        pnl.Display(name + zScoreIsFromMean_);
    }
    public static void RunConstantVolTargetted_BondFutures(bool persist_, bool zScoreIsFromMean_ = false, double scoreShift_ = 0.1)
    {
      var name = BondFutures_ConstantVolTargetted;
      var args = getBaseFuturesTraderArgs(x => x.AssetClass.Equals("Fixed Income") && (x.Country.Equals("US") || x.Country.Equals("Germany")));
      args.DayOffset = 0;

      {
        var volWt = new Backtest.Builder.Model.WtScheme();
        volWt.VolWt.Enabled = true;
        volWt.VolWt.VolType = Backtest.VolType.hist;
        volWt.VolWt.WindowLength = 252;

        args.WtIndicators.Add(new Multi_NPeriodMomentum_SharpeFilter_Fade()
        {
          ZScoreIsFromMean = zScoreIsFromMean_,
          ScoreShift = scoreShift_
        }
          );
        args.WtIndicators[0].TransformList.Add(volWt);
      }

      {
        args.ScaleToThisVol = 0.06;
        args.ScaleToVol = true;
        args.VolTypeForScaling = Backtest.VolType.covar;
      }

      var trader = Singleton<Backtest.TraderGen>.Instance;

      var wts = trader.GetWeights(args);

      var pnl = trader.DoPnl(args, wts);

      if (persist_)
        persistResult(name, wts, pnl);
      else
        pnl.Display(name + zScoreIsFromMean_);
    }
    public static void RunConstantVolTargetted_FX(bool persist_, bool zScoreIsFromMean_ = false, double scoreShift_ = 0.1)
    {
      var name = FX_ConstantVolTargetted;

      var args = getBaseFXTraderArgs();
      args.DayOffset = 0;

      {
        var volWt = new Backtest.Builder.Model.WtScheme();
        volWt.VolWt.Enabled = true;
        volWt.VolWt.VolType = Backtest.VolType.covar;

        args.WtIndicators.Add(new Multi_NPeriodMomentum_SharpeFilter_Fade()
        {
          ZScoreIsFromMean = zScoreIsFromMean_,
          ScoreShift = scoreShift_
        }
          );
        args.WtIndicators[0].TransformList.Add(volWt);
      }

      {
        args.ScaleToThisVol = 0.06;
        args.ScaleToVol = true;
        args.VolTypeForScaling = Backtest.VolType.covar;
      }

      var trader = Singleton<Backtest.TraderFX>.Instance;

      var wts = trader.GetWeights(args);

      var pnl = trader.DoPnl(args, wts);

      if(persist_)
        persistResult(name, wts, pnl);
      else
        pnl.Display(name + zScoreIsFromMean_);
    }