public ManualStrategySetting()
        {
            RetryTimes = 8;
            Direction  = PTEntity.PosiDirectionType.LONG;

            StopGainCondition = PTEntity.CompareCondition.GREATER_THAN;
            StopGainThreshold = 10;
            StopLossCondition = PTEntity.CompareCondition.GREATER_THAN;
            StopLossThreshold = 6;
            StopLossType      = PTEntity.StopPriceType.LOSS_STOP;
        }
        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;
        }
        public override void Load(string xmlText)
        {
            XElement   elem = XElement.Parse(xmlText);
            XAttribute attr = elem.Attribute("retryTimes");

            if (attr != null)
            {
                RetryTimes = int.Parse(attr.Value);
            }
            attr = elem.Attribute("direction");
            if (attr != null)
            {
                Direction = (PTEntity.PosiDirectionType)Enum.Parse(typeof(PTEntity.PosiDirectionType), attr.Value);
            }

            XElement elemStopGain = elem.Element("stopGain");

            if (elemStopGain != null)
            {
                attr = elemStopGain.Attribute("condition");
                if (attr != null)
                {
                    StopGainCondition = (PTEntity.CompareCondition)Enum.Parse(typeof(PTEntity.CompareCondition), attr.Value);
                }

                attr = elemStopGain.Attribute("threshold");
                if (attr != null)
                {
                    StopGainThreshold = double.Parse(attr.Value);
                }
            }
            XElement elemStopLoss = elem.Element("stopLoss");

            if (elemStopLoss != null)
            {
                attr = elemStopLoss.Attribute("condition");
                if (attr != null)
                {
                    StopLossCondition = (PTEntity.CompareCondition)Enum.Parse(typeof(PTEntity.CompareCondition), attr.Value);
                }
                attr = elemStopLoss.Attribute("threshold");
                if (attr != null)
                {
                    StopLossThreshold = double.Parse(attr.Value);
                }
                attr = elemStopLoss.Attribute("stopLossType");
                if (attr != null)
                {
                    StopLossType = (PTEntity.StopPriceType)Enum.Parse(typeof(PTEntity.StopPriceType), attr.Value);
                }
            }
        }