private void LoadSavedConfig(ZbPrice price)
 {
     radZbLong.Checked = price.IsLong;
     radZbShort.Checked = !price.IsLong;
     numZbStopLossSize.Value = Convert.ToDecimal(price.StopLossSize);
     numZbProfitTargetSize.Value = Convert.ToDecimal(price.ProfitTargetSize);
     numZbPriceMain.Value = Convert.ToDecimal(price.PriceMainPart);
     numZbPriceDegrees.Value = Convert.ToDecimal(price.PriceDecimalPart);
 }
Exemplo n.º 2
0
 private void LoadSavedConfig(ZbPrice price)
 {
     radZbLong.Checked           = price.IsLong;
     radZbShort.Checked          = !price.IsLong;
     numZbStopLossSize.Value     = Convert.ToDecimal(price.StopLossSize);
     numZbProfitTargetSize.Value = Convert.ToDecimal(price.ProfitTargetSize);
     numZbPriceMain.Value        = Convert.ToDecimal(price.PriceMainPart);
     numZbPriceDegrees.Value     = Convert.ToDecimal(price.PriceDecimalPart);
 }
        private void frmMain_Load(object sender, EventArgs e)
        {
            try
            {
                isInternalChange = true;
                m_ZbPrice = ZbPrice.LoadFromConfig();
                m_EsPrice = EsPrice.LoadFromConfig();

                LoadSavedConfig(m_ZbPrice);
                LoadSavedConfig(m_EsPrice);
            }
            finally
            {
                isInternalChange = false;
            }

            UpdateZbUi();
            UpdateEsUi();
        }
Exemplo n.º 4
0
        private void frmMain_Load(object sender, EventArgs e)
        {
            try
            {
                isInternalChange = true;
                m_ZbPrice        = ZbPrice.LoadFromConfig();
                m_EsPrice        = EsPrice.LoadFromConfig();

                LoadSavedConfig(m_ZbPrice);
                LoadSavedConfig(m_EsPrice);
            }
            finally
            {
                isInternalChange = false;
            }

            UpdateZbUi();
            UpdateEsUi();
        }
        public static ZbPrice GetZbPrice(this double price)
        {
            // now do the split - the apres decimal precision defined by 

            // the format function which defaults to 2 places i.e. "0.00"
            string splitValue = price.ToString(string.Format("0.{0}",
                new String('0', 10)), CultureInfo.InvariantCulture);
            string[] splitParts = splitValue.Split('.');

            var fractionPart = double.Parse("0." + splitParts[1]);
            int degreePart = Convert.ToInt32(fractionPart*32);
            // now factor out derived splits as ints into struct
            var value = new ZbPrice
            {
                PriceMainPart = int.Parse(splitParts[0]),
                PriceDecimalPart = degreePart
            };

            return value;
        }
Exemplo n.º 6
0
 private void frmMain_FormClosing(object sender, FormClosingEventArgs e)
 {
     EsPrice.SaveToConfig(m_EsPrice);
     ZbPrice.SaveToConfig(m_ZbPrice);
 }