コード例 #1
0
        /// <summary>
        /// Clones the Instrument_Properties.
        /// </summary>
        public Instrument_Properties Clone()
        {
            Instrument_Properties copy = new Instrument_Properties(symbol);

            copy.Symbol         = Symbol;
            copy.Digits         = Digits;
            copy.LotSize        = LotSize;
            copy.Spread         = Spread;
            copy.StopLevel      = StopLevel;
            copy.SwapLong       = SwapLong;
            copy.SwapShort      = SwapShort;
            copy.TickValue      = TickValue;
            copy.MinLot         = MinLot;
            copy.MaxLot         = MaxLot;
            copy.LotStep        = LotStep;
            copy.MarginRequired = MarginRequired;

            return(copy);
        }
コード例 #2
0
        /// <summary>
        /// LoadInstrument
        /// </summary>
        int LoadInstrument(bool bUseResource)
        {
            string      sSymbol    = "EURUSD";
            DataPeriods dataPeriod = DataPeriods.day;

            Instrument_Properties instrProperties = new Instrument_Properties(sSymbol);
            Instrument            instrument      = new Instrument(instrProperties, (int)dataPeriod);
            int iLoadDataResult = instrument.LoadResourceData();

            if (instrument.Bars > 0 && iLoadDataResult == 0)
            {
                Data.InstrProperties = instrProperties.Clone();

                Data.Bars   = instrument.Bars;
                Data.Period = dataPeriod;

                Data.Time   = new DateTime[Data.Bars];
                Data.Open   = new double[Data.Bars];
                Data.High   = new double[Data.Bars];
                Data.Low    = new double[Data.Bars];
                Data.Close  = new double[Data.Bars];
                Data.Volume = new int[Data.Bars];

                for (int iBar = 0; iBar < Data.Bars; iBar++)
                {
                    Data.Open[iBar]   = instrument.Open(iBar);
                    Data.High[iBar]   = instrument.High(iBar);
                    Data.Low[iBar]    = instrument.Low(iBar);
                    Data.Close[iBar]  = instrument.Close(iBar);
                    Data.Time[iBar]   = instrument.Time(iBar);
                    Data.Volume[iBar] = instrument.Volume(iBar);
                }

                Data.IsData = true;
            }

            return(0);
        }
コード例 #3
0
 /// <summary>
 /// Constructor
 /// </summary>
 public Instrument(Instrument_Properties instrProperties, int iPeriod)
 {
     this.instrProperties = instrProperties;
     this.period = iPeriod;
 }
コード例 #4
0
 /// <summary>
 /// Constructor
 /// </summary>
 public Instrument(Instrument_Properties instrProperties, int iPeriod)
 {
     this.instrProperties = instrProperties;
     this.period          = iPeriod;
 }
コード例 #5
0
        /// <summary>
        /// Clones the Instrument_Properties.
        /// </summary>
        public Instrument_Properties Clone()
        {
            Instrument_Properties copy = new Instrument_Properties(symbol);

            copy.Symbol         = Symbol;
            copy.Digits         = Digits;
            copy.LotSize        = LotSize;
            copy.Spread         = Spread;
            copy.StopLevel      = StopLevel;
            copy.SwapLong       = SwapLong;
            copy.SwapShort      = SwapShort;
            copy.TickValue      = TickValue;
            copy.MinLot         = MinLot;
            copy.MaxLot         = MaxLot;
            copy.LotStep        = LotStep;
            copy.MarginRequired = MarginRequired;

            return copy;
        }
コード例 #6
0
        /// <summary>
        /// LoadInstrument
        /// </summary>
        int LoadInstrument(bool bUseResource)
        {
            string      sSymbol    = "EURUSD";
            DataPeriods dataPeriod = DataPeriods.day;

            Instrument_Properties instrProperties = new Instrument_Properties(sSymbol);
            Instrument instrument = new Instrument(instrProperties, (int)dataPeriod);
            int iLoadDataResult = instrument.LoadResourceData();

            if (instrument.Bars > 0 && iLoadDataResult == 0)
            {
                Data.InstrProperties = instrProperties.Clone();

                Data.Bars   = instrument.Bars;
                Data.Period = dataPeriod;

                Data.Time   = new DateTime[Data.Bars];
                Data.Open   = new double[Data.Bars];
                Data.High   = new double[Data.Bars];
                Data.Low    = new double[Data.Bars];
                Data.Close  = new double[Data.Bars];
                Data.Volume = new int[Data.Bars];

                for (int iBar = 0; iBar < Data.Bars; iBar++)
                {
                    Data.Open[iBar]   = instrument.Open(iBar);
                    Data.High[iBar]   = instrument.High(iBar);
                    Data.Low[iBar]    = instrument.Low(iBar);
                    Data.Close[iBar]  = instrument.Close(iBar);
                    Data.Time[iBar]   = instrument.Time(iBar);
                    Data.Volume[iBar] = instrument.Volume(iBar);
                }

                Data.IsData = true;
            }

            return 0;
        }