/// <summary>
        /// Constructor
        /// </summary>
        public Candle(DateTime date, //DateTime dateOutput,
                      double bidOpen, double bidHigh, double bidLow, double bidClose,
                      double askOpen, double askHigh, double askLow, double askClose,
                      double volume, bool isCompleted, Timeframe timeframe, int precision)
        {
            mDate = date;
            // mDateOutput = dateOutput;

            mBidOpen  = bidOpen;
            mBidHigh  = bidHigh;
            mBidLow   = bidLow;
            mBidClose = bidClose;

            mAskOpen  = askOpen;
            mAskHigh  = askHigh;
            mAskLow   = askLow;
            mAskClose = askClose;

            mVolume = volume;

            mTimeframeUnit = timeframe.Unit;
            mIsCompleted   = isCompleted;

            mPrecision = precision;
        }
 /// <summary>
 /// Constructor
 /// </summary>
 public CandleHistory(string instrument,
                      Timeframe timeframe, TimeFrameCalculator calculator, int precision)
 {
     mInstrument       = instrument;
     mTimeframe        = timeframe;
     mLastMinute       = new DateTime(0);
     mLastMinuteVolume = 0;
     mCalculator       = calculator;
     mLoaded           = false;
     mID        = (Guid.NewGuid().ToString());
     mPrecision = precision;
 }
Esempio n. 3
0
 internal CandleManagerHistory(TransportHistoryRequest request, bool subscribe, TimeFrameCalculator calculator, int precision)
 {
     mPrecision = precision;
     mTimeframe = Timeframe.Parse(request.Timeframe);
     mHistory   = new CandleHistory(request.Instrument, mTimeframe, calculator, mPrecision);
     if (subscribe)
     {
         mTicks = new LinkedList <Tick>();
     }
     mWaitForData = true;
     mSubscribe   = subscribe;
     mFailed      = false;
     mCount       = request.Count;
     mLastMinute  = DateTime.MinValue;
 }
 public DateTime GetCandle(Timeframe timeframe, DateTime time)
 {
     return(timeframe.GetCandle(time, mDayOffset, mWeekOffset));
 }
 /// <summary>
 /// Add historical candle
 /// </summary>
 public void AddCandle(DateTime date, double bidopen, double bidhigh, double bidlow, double bidclose,
                       double askopen, double askhigh, double asklow, double askclose,
                       double volume, bool isCompleted, int position, Timeframe timeframe)
 {
     mCandles.Insert(position, new Candle(date, bidopen, bidhigh, bidlow, bidclose, askopen, askhigh, asklow, askclose, volume, isCompleted, timeframe, mPrecision));
 }