/// <summary>
 ///     Constructor
 /// </summary>
 public InstrumentProperties(string symbol, InstrumetType instrType)
 {
     if (instrType == InstrumetType.Forex)
     {
         SetDefaultForexParams(symbol, instrType);
     }
     else
     {
         SetDefaultIndexParams(symbol, instrType);
     }
 }
 /// <summary>
 ///     Constructor
 /// </summary>
 public InstrumentProperties(string symbol, InstrumetType instrType)
 {
     if (instrType == InstrumetType.Forex)
     {
         SetDefaultForexParams(symbol, instrType);
     }
     else
     {
         SetDefaultIndexParams(symbol, instrType);
     }
 }
 private void SetDefaultForexParams(string symbol, InstrumetType instrType)
 {
     Symbol          = symbol;
     InstrType       = instrType;
     Comment         = symbol.Substring(0, 3) + " vs " + symbol.Substring(3, 3);
     Digits          = (symbol.Contains("JPY") ? 3 : 5);
     LotSize         = 100000;
     Spread          = 20;
     SwapUnit        = ChargeUnit.Points;
     SwapLong        = 2;
     SwapShort       = -2;
     CommissionUnit  = ChargeUnit.Points;
     CommissionScope = CommissionScope.lot;
     CommissionTime  = CommissionTime.openclose;
     Commission      = 0;
     Slippage        = 0;
     PriceIn         = symbol.Substring(3, 3);
     RateToUSD       = (symbol.Contains("JPY") ? 100 : 1);
     RateToEUR       = (symbol.Contains("JPY") ? 100 : 1);
     BaseFileName    = symbol;
 }
 private void SetDefaultIndexParams(string symbol, InstrumetType instrType)
 {
     Symbol          = symbol;
     InstrType       = instrType;
     Comment         = symbol + " " + instrType;
     Digits          = 2;
     LotSize         = 100;
     Spread          = 4;
     SwapUnit        = ChargeUnit.Percents;
     SwapLong        = -5;
     SwapShort       = -1;
     CommissionUnit  = ChargeUnit.Percents;
     CommissionScope = CommissionScope.deal;
     CommissionTime  = CommissionTime.openclose;
     Commission      = 0.25f;
     Slippage        = 0;
     PriceIn         = "USD";
     RateToUSD       = 1;
     RateToEUR       = 1;
     BaseFileName    = symbol;
 }
 private void SetDefaultForexParams(string symbol, InstrumetType instrType)
 {
     Symbol = symbol;
     InstrType = instrType;
     Comment = symbol.Substring(0, 3) + " vs " + symbol.Substring(3, 3);
     Digits = (symbol.Contains("JPY") ? 3 : 5);
     LotSize = 100000;
     Spread = 20;
     SwapUnit = ChargeUnit.Points;
     SwapLong = 2;
     SwapShort = -2;
     CommissionUnit = ChargeUnit.Points;
     CommissionScope = CommissionScope.lot;
     CommissionTime = CommissionTime.openclose;
     Commission = 0;
     Slippage = 0;
     PriceIn = symbol.Substring(3, 3);
     RateToUSD = (symbol.Contains("JPY") ? 100 : 1);
     RateToEUR = (symbol.Contains("JPY") ? 100 : 1);
     BaseFileName = symbol;
 }
 private void SetDefaultIndexParams(string symbol, InstrumetType instrType)
 {
     Symbol = symbol;
     InstrType = instrType;
     Comment = symbol + " " + instrType;
     Digits = 2;
     LotSize = 100;
     Spread = 4;
     SwapUnit = ChargeUnit.Percents;
     SwapLong = -5;
     SwapShort = -1;
     CommissionUnit = ChargeUnit.Percents;
     CommissionScope = CommissionScope.deal;
     CommissionTime = CommissionTime.openclose;
     Commission = 0.25f;
     Slippage = 0;
     PriceIn = "USD";
     RateToUSD = 1;
     RateToEUR = 1;
     BaseFileName = symbol;
 }
        /// <summary>
        ///     Validates the instrument properties
        /// </summary>
        private bool ValidateSymbol(string symbol, InstrumetType instrType)
        {
            bool isResult;

            if (instrType == InstrumetType.Forex)
            {
                var regex = new Regex(@"^[A-Z]{6}$");
                isResult = (regex.IsMatch(symbol) && symbol.Substring(0, 3) != symbol.Substring(3, 3));
            }
            else
            {
                var regex = new Regex(@"^[a-zA-Z\$\#]");
                isResult = regex.IsMatch(symbol);
            }

            return isResult;
        }