예제 #1
0
        /// <summary>
        /// set fields to config from xml
        /// </summary>
        void ConfigLoad(string path, string file)
        {
            // load config from xml
            ConfigXml22 xml = new ConfigXml22(path, file);

            xml.Load();

            // set fields to xml values
            configBearContValue = xml.BearContValue;
            configBearInitType  = xml.BearInitType;
            configBearInitValue = xml.BearInitValue;
            configBearRangeMax  = xml.BearRangeMax;
            configBearRangeMin  = xml.BearRangeMin;
            configBullContValue = xml.BullContValue;
            configBullInitType  = xml.BullInitType;
            configBullInitValue = xml.BullInitValue;
            configBullRangeMax  = xml.BullRangeMax;
            configBullRangeMin  = xml.BullRangeMin;
            configCloseOption   = (EmCloses)Enum.Parse(typeof(EmCloses), xml.CloseOption);
            configOpenOption    = (EmOpens)Enum.Parse(typeof(EmOpens), xml.OpenOption);

            // calculate bear/bull min/max
            RangeInit();

            // update configLoaded
            configLoaded = true;
        }
예제 #2
0
 /// constructors
 public ResyncEventArgs(
     int id,
     int bearCV,
     int bearIT,
     int bearIV,
     int bearMax,
     int bearMin,
     int bullCV,
     int bullIT,
     int bullIV,
     int bullMax,
     int bullMin,
     EmCloses close,
     EmOpens open
     )
 {
     configId      = id;
     bearContValue = bearCV;
     bearInitType  = bearIT;
     bearInitValue = bearIV;
     bearRangeMax  = bearMax;
     bearRangeMin  = bearMin;
     bullContValue = bullCV;
     bullInitType  = bullIT;
     bullInitValue = bullIV;
     bullRangeMax  = bullMax;
     bullRangeMin  = bullMin;
     closeOption   = close;
     openOption    = open;
 }
예제 #3
0
 /// <summary>
 /// reset fields to default config
 /// </summary>
 void ConfigReset()
 {
     configBearContValue = configBullContValue = configBearInitValue = configBullInitValue = 0;
     configBearInitType  = configBullInitType = 0;
     configBearRangeMax  = configBearRangeMin = configBullRangeMax = configBullRangeMin = 4;
     configCloseOption   = EmCloses.TickThru;
     configOpenOption    = EmOpens.TrueOpen;
 }
예제 #4
0
        /// methods
        /// <summary>
        /// apply config from modal dialog
        /// </summary>
        void ApplyConfig(object sender, ResyncEventArgs e)
        {
            // ensure configId
            if (configId == e.ConfigId)
            {
                // update fields
                configBearContValue = e.BearContValue;
                configBearInitType  = e.BearInitType;
                configBearInitValue = e.BearInitValue;
                configBearRangeMax  = e.BearRangeMax;
                configBearRangeMin  = e.BearRangeMin;
                configBullContValue = e.BullContValue;
                configBullInitType  = e.BullInitType;
                configBullInitValue = e.BullInitValue;
                configBullRangeMax  = e.BullRangeMax;
                configBullRangeMin  = e.BullRangeMin;
                configCloseOption   = e.CloseOption;
                configOpenOption    = e.OpenOption;

                // reset calculations
                if (tickSize > 0)
                {
                    tickBearRangeMax = Math.Floor(10000000.0 * (double)e.BearRangeMax * tickSize) / 10000000.0;
                    tickBearRangeMin = Math.Floor(10000000.0 * (double)e.BearRangeMin * tickSize) / 10000000.0;
                    tickBullRangeMax = Math.Floor(10000000.0 * (double)e.BullRangeMax * tickSize) / 10000000.0;
                    tickBullRangeMin = Math.Floor(10000000.0 * (double)e.BullRangeMin * tickSize) / 10000000.0;
                }

                // set configLoaded
                configLoaded = true;
            }
            else
            {
                configLoaded = false;
            }
        }