Ejemplo n.º 1
0
        private void pushRenko(double dAsk, double dBid, DateTime dtTime)
        {
            if (m_dRenkoStep < 0)
            {
                return;
            }
            double dCurVal = (dAsk + dBid) / 2;

            if (Math.Abs(m_dLastRenkoVal - dCurVal) < m_dRenkoStep)
            {
                return;
            }

            m_dLastRenkoVal = dCurVal;
            m_nCurPos_renko++;
            if (m_renkoData.Count < CFATCommon.CACHE_SIZE)
            {
                TRatesTick renkoRates = new TRatesTick();
                renkoRates.dAsk     = dAsk;
                renkoRates.dBid     = dBid;
                renkoRates.m_dtTime = dtTime;
                m_renkoData.Add(renkoRates);
            }
            else
            {
                if (m_nCurPos_renko == CFATCommon.CACHE_SIZE)
                {
                    m_nCurPos_renko = 0;
                }
                m_renkoData[m_nCurPos_renko].dAsk     = dAsk;
                m_renkoData[m_nCurPos_renko].dBid     = dBid;
                m_renkoData[m_nCurPos_renko].m_dtTime = dtTime;
            }
        }
Ejemplo n.º 2
0
        public void pushTick(double dAsk, double dBid, DateTime dtTime)
        {
            m_nCurPos_tick++;
            if (m_tickData.Count < CFATCommon.CACHE_SIZE)
            {
                TRatesTick tick = new TRatesTick();
                tick.dAsk     = dAsk;
                tick.dBid     = dBid;
                tick.m_dtTime = dtTime;
                m_tickData.Add(tick);
            }
            else
            {
                if (m_nCurPos_tick == CFATCommon.CACHE_SIZE)
                {
                    m_nCurPos_tick = 0;
                }
                m_tickData[m_nCurPos_tick].dAsk     = dAsk;
                m_tickData[m_nCurPos_tick].dBid     = dBid;
                m_tickData[m_nCurPos_tick].m_dtTime = dtTime;
            }
            pushMin(dAsk, dBid, dtTime);
            pushRenko(dAsk, dBid, dtTime);

            autoSave();
        }