/// <summary> /// Clones the Instrument_Properties. /// </summary> public InstrumentProperties Clone() { var copy = new InstrumentProperties(Symbol) { Symbol = Symbol, Digits = Digits, LotSize = LotSize, Spread = Spread, StopLevel = StopLevel, SwapLong = SwapLong, SwapShort = SwapShort, TickValue = TickValue, MinLot = MinLot, MaxLot = MaxLot, LotStep = LotStep, MarginRequired = MarginRequired }; return(copy); }
/// <summary> /// LoadInstrument /// </summary> private void LoadInstrument() { const string symbol = "EURUSD"; const DataPeriods dataPeriod = DataPeriods.day; var instrProperties = new InstrumentProperties(symbol); var instrument = new Instrument(instrProperties, (int)dataPeriod); int loadResourceData = instrument.LoadResourceData(); if (instrument.Bars <= 0 || loadResourceData != 0) { return; } 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 bar = 0; bar < Data.Bars; bar++) { Data.Open[bar] = instrument.Open(bar); Data.High[bar] = instrument.High(bar); Data.Low[bar] = instrument.Low(bar); Data.Close[bar] = instrument.Close(bar); Data.Time[bar] = instrument.Time(bar); Data.Volume[bar] = instrument.Volume(bar); } Data.IsData = true; }
/// <summary> /// Clones the Instrument_Properties. /// </summary> public InstrumentProperties Clone() { var copy = new InstrumentProperties(Symbol) { Symbol = Symbol, Digits = Digits, LotSize = LotSize, Spread = Spread, StopLevel = StopLevel, SwapLong = SwapLong, SwapShort = SwapShort, TickValue = TickValue, MinLot = MinLot, MaxLot = MaxLot, LotStep = LotStep, MarginRequired = MarginRequired }; return copy; }
/// <summary> /// LoadInstrument /// </summary> private void LoadInstrument() { const string symbol = "EURUSD"; const DataPeriods dataPeriod = DataPeriods.day; var instrProperties = new InstrumentProperties(symbol); var instrument = new Instrument(instrProperties, (int) dataPeriod); int loadResourceData = instrument.LoadResourceData(); if (instrument.Bars <= 0 || loadResourceData != 0) return; 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 bar = 0; bar < Data.Bars; bar++) { Data.Open[bar] = instrument.Open(bar); Data.High[bar] = instrument.High(bar); Data.Low[bar] = instrument.Low(bar); Data.Close[bar] = instrument.Close(bar); Data.Time[bar] = instrument.Time(bar); Data.Volume[bar] = instrument.Volume(bar); } Data.IsData = true; }
/// <summary> /// Constructor /// </summary> public Instrument(InstrumentProperties instrProperties, int iPeriod) { _instrProperties = instrProperties; _period = iPeriod; }