Beispiel #1
0
        public static StrategySetting Load(string name, string xmlText)
        {
            StrategySetting setting = Create(name);

            setting.Load(xmlText);
            return(setting);
        }
        public override void CopyFrom(StrategySetting settings)
        {
            ChangePositionSetting strategySettings = (ChangePositionSetting)settings;

            this.CloseLeg         = strategySettings.CloseLeg;
            this.CloseLegSide     = strategySettings.CloseLegSide;
            this.TriggerCondition = strategySettings.TriggerCondition;
            this.Threshold        = strategySettings.Threshold;
        }
Beispiel #3
0
        public override void CopyFrom(StrategySetting settings)
        {
            ASCTrendStrategySettings otherSettings = (ASCTrendStrategySettings)settings;

            Risk           = otherSettings.Risk;
            AvergatePeriod = otherSettings.AvergatePeriod;
            BreakoutLength = otherSettings.BreakoutLength;
            Period         = otherSettings.Period;
        }
Beispiel #4
0
        public override void CopyFrom(StrategySetting settings)
        {
            LinerRegStrategySettings otherSettings = (LinerRegStrategySettings)settings;

            Symbol         = otherSettings.Symbol;
            Period         = otherSettings.Period;
            Number         = otherSettings.Number;
            OpenThreshold  = otherSettings.OpenThreshold;
            CloseThreshold = otherSettings.CloseThreshold;
        }
        public override void CopyFrom(StrategySetting settings)
        {
            WMATrendStrategySettings otherSettings = (WMATrendStrategySettings)settings;

            Symbol            = otherSettings.Symbol;
            WMA_Param         = otherSettings.WMA_Param;
            MA_N              = otherSettings.MA_N;
            Period            = otherSettings.Period;
            TrailingStopValue = otherSettings.TrailingStopValue;
        }
 public void SetPortfolio(PortfolioVM portfVm)
 {
     this.AccountId        = portfVm.AccountId;
     this.PortfolioID      = portfVm.Id;
     this.StrategyType     = StrategySetting.GetDisplayStrategyName(portfVm.StrategySetting.Name);
     this.CurrentPortfolio = portfVm;
     BeforeCopySettings();
     this.Settings.CopyFrom(portfVm.StrategySetting);
     AfterCopySettings();
     OnSetPortfolio(portfVm);
 }
Beispiel #7
0
        public override void CopyFrom(StrategySetting settings)
        {
            RangeTrendStrategySettings otherSettings = (RangeTrendStrategySettings)settings;

            OpenPeriod     = otherSettings.OpenPeriod;
            ClosePeriod    = otherSettings.ClosePeriod;
            StopLossFactor = otherSettings.StopLossFactor;
            TrendFactor    = otherSettings.TrendFactor;

            Period = otherSettings.Period;
        }
        public override void CopyFrom(StrategySetting settings)
        {
            ManualStrategySetting strategySetting = (ManualStrategySetting)settings;

            RetryTimes        = strategySetting.RetryTimes;
            Direction         = strategySetting.Direction;
            StopGainCondition = strategySetting.StopGainCondition;
            StopGainThreshold = strategySetting.StopGainThreshold;
            StopLossCondition = strategySetting.StopLossCondition;
            StopLossThreshold = strategySetting.StopLossThreshold;
            StopLossType      = strategySetting.StopLossType;
        }
Beispiel #9
0
        public override void CopyFrom(StrategySetting settings)
        {
            ScalperSetting strategySettings = (ScalperSetting)settings;

            Threshold           = strategySettings.Threshold;
            PriceTick           = strategySettings.PriceTick;
            CaseLE2Tick         = strategySettings.CaseLE2Tick;
            CaseLE3Tick         = strategySettings.CaseLE3Tick;
            CaseGE4Tick         = strategySettings.CaseGE4Tick;
            CaseNoChange        = strategySettings.CaseNoChange;
            StopLossCloseMethod = strategySettings.StopLossCloseMethod;
            RetryTimes          = strategySettings.RetryTimes;
            OpenTimeout         = strategySettings.OpenTimeout;
        }
Beispiel #10
0
        public static StrategySetting Create(string name)
        {
            StrategySetting setting = null;

            switch (name)
            {
            case ArbitrageStrategyName:
                setting = new ArbitrageStrategySetting();
                break;

            case ChangePositionStrategyName:
                setting = new ChangePositionSetting();
                break;

            case ScalperStrategyName:
                setting = new ScalperSetting();
                break;

            case MACDHistSlopeStrategyName:
                setting = new MACDHistSlopeStrategySetting();
                break;

            case WMATrendStrategyName:
                setting = new WMATrendStrategySettings();
                break;

            case LinerRegressionStrategyName:
                setting = new LinerRegStrategySettings();
                break;

            case ASCTrendStrategyName:
                setting = new ASCTrendStrategySettings();
                break;

            case RangeTrendStrategyName:
                setting = new RangeTrendStrategySettings();
                break;

            case ManualStrategyName:
                setting = new ManualStrategySetting();
                break;

            default:
                throw new ArgumentException(string.Format("Unexpected strategy setting ({0})", name));
            }
            return(setting);
        }
        public override void CopyFrom(StrategySetting settings)
        {
            ArbitrageStrategySetting strategySettings = (ArbitrageStrategySetting)settings;

            this.BollPeriod       = strategySettings.BollPeriod;
            this.StdDevMultiplier = strategySettings.StdDevMultiplier;
            this.FirstLegSymbol   = strategySettings.FirstLegSymbol;
            this.SecondLegSymbol  = strategySettings.SecondLegSymbol;
            this.TimeFrame        = strategySettings.TimeFrame;

            this.Direction         = strategySettings.Direction;
            this.OpenCondition     = strategySettings.OpenCondition;
            this.OpenThreshold     = strategySettings.OpenThreshold;
            this.StopGainCondition = strategySettings.StopGainCondition;
            this.StopGainThreshold = strategySettings.StopGainThreshold;
            this.StopLossCondition = strategySettings.StopLossCondition;
            this.StopLossThreshold = strategySettings.StopLossThreshold;
        }
Beispiel #12
0
        public override void CopyFrom(StrategySetting settings)
        {
            MACDHistSlopeStrategySetting otherSettings = (MACDHistSlopeStrategySetting)settings;

            Symbol             = otherSettings.Symbol;
            MACD_Short         = otherSettings.MACD_Short;
            MACD_Long          = otherSettings.MACD_Long;
            MACD_M             = otherSettings.MACD_M;
            FastPeriod         = otherSettings.FastPeriod;
            FastStdDiff        = otherSettings.FastStdDiff;
            FastShortSeed      = otherSettings.FastShortSeed;
            FastLongSeed       = otherSettings.FastLongSeed;
            FastSignalSeed     = otherSettings.FastSignalSeed;
            FastAngleThreshold = otherSettings.FastAngleThreshold;
            SlowPeriod         = otherSettings.SlowPeriod;
            SlowStdDiff        = otherSettings.SlowStdDiff;
            SlowShortSeed      = otherSettings.SlowShortSeed;
            SlowLongSeed       = otherSettings.SlowLongSeed;
            SlowSignalSeed     = otherSettings.SlowSignalSeed;
            SlowAngleThreshold = otherSettings.SlowAngleThreshold;
            FastReverseAngle   = otherSettings.FastReverseAngle;
            TrailingStopValue  = otherSettings.TrailingStopValue;
        }
Beispiel #13
0
 public abstract void CopyFrom(StrategySetting settings);