function RefreshTimedBars(cqg_timed_bars, index_)

global m_CEL;
global m_TimedBarsResult;

try
    
    TimedBarRecord = cqg_timed_bars.Item(index_);
    
    m_TimedBarsResult{index_ + 1, 1} = index_ + 1;
    
    for h = 1:9

        switch h

            case 1
                recValue = TimedBarRecord.Timestamp;

            case 2
                recValue = TimedBarRecord.Open;

            case 3
                recValue = TimedBarRecord.High;

            case 4
                recValue = TimedBarRecord.Low;

            case 5
                recValue = TimedBarRecord.Close;

            case 6
                recValue = TimedBarRecord.Mid;

            case 7
                recValue = TimedBarRecord.HLC3;

            case 8
                recValue = TimedBarRecord.Avg;

            case 9
                recValue = TimedBarRecord.TickVolume;
                
            otherwise
                recValue = NaN;

        end

        if ~(m_CEL.IsValid(recValue))
            recValue = NaN;
        end

        m_TimedBarsResult{index_ + 1, h + 1} = recValue;

    end
    
catch
    CEL_ShutDown;
    disp('An error occurred in RefreshTimedBars.m file.');
end