Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

multitime frame OHLC values differs with tradingview

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    multitime frame OHLC values differs with tradingview

    I am a new to the indicator development...

    Trying to get OHLC values using multitime frame.

    However the values aren't matching with the values I see from the tradingview....

    Instrument : MNQ DEC24

    Ninja Oct Month OHLC O : 20232 H : 20789.75 L : 19818 C: 20021.75
    Tradingview Oct Month OHLC O : 20524 H : 20789.75 L : 20007.75 C: 20153.25

    Corresponding record From log entry below
    Month Bars Processing : 9/30/2024 5:00:00 PM -to- 10/31/2024 5:00:00 PM| O 20232 | H 20789.75 | L 19818| C 20021.75 | MonthCounter : 2

    Not sure what's wrong in the code , can someone review and let me know


    Code:
    public class MyIndicator: Indicator
    {
        protected override void OnStateChange()
        {
    
            if (State == State.SetDefaults)
            {
                Description = @"";
                Name = "_My Indicator";
                Calculate = Calculate.OnBarClose;
                IsOverlay = true;
                IsAutoScale = false;
                DisplayInDataBox = false;
                DrawOnPricePanel = true;
                DrawHorizontalGridLines = true;
                DrawVerticalGridLines = true;
                PaintPriceMarkers = false;
                ScaleJustification = NinjaTrader.Gui.Chart.ScaleJustification.Right;
                IsSuspendedWhileInactive = true;
    
    
            }
            else if (State == State.Configure)
            {
                AddDataSeries(BarsPeriodType.Week, 1);  // index 1
                AddDataSeries(BarsPeriodType.Month, 1); // index 2
            }
        }
    
        int monthCounter = 1;
        int weekCounter = 1;
        protected override void OnBarUpdate()
        {
    
            if (BarsInProgress == 0)
                return;
    
    
            if (BarsInProgress == 2 && CurrentBars[2] > 1)
            {
                DateTime barOpen = Times[2][0] - (Times[2][0] - Times[2][1]);
    
                Print($"Month Bars Processing : {barOpen} -to- {Times[2][0]}| O {Opens[2][0]} | H {Highs[2][0]} | L {Lows[2][0]}| C {Closes[2][0]} | MonthCounter : {monthCounter++}");
    
            }
            if (BarsInProgress == 1 && CurrentBars[1] > 1)
            {
                DateTime barOpen = Times[1][0] - (Times[1][0] - Times[1][1]);
                Print($"Weekly Bar Processing : {barOpen} -to- {Times[1][0]} | O {Opens[1][0]} | H {Highs[1][0]} | L {Lows[1][0]}| C {Closes[1][0]}| WeekCounter : {weekCounter++}");
    
            }
    
        }//OnBarUpdate
    
    }​
    Output
    Code:
    Weekly Bar Processing : 8/9/2024  5:00:00 PM -to- 8/16/2024 5:00:00 PM | O 18827    | H 19918.25 | L 18749.75     | C 19841    | WeekCounter : 1
    Weekly Bar Processing : 8/16/2024 5:00:00 PM -to- 8/23/2024 5:00:00 PM | O 19863.5  | H 20261    | L 19760.25     | C 20026    | WeekCounter : 2
    Weekly Bar Processing : 8/23/2024 5:00:00 PM -to- 8/30/2024 5:00:00 PM | O 20023.25 | H 20081.5  | L 19374.25     | C 19858.25 | WeekCounter : 3
    Weekly Bar Processing : 8/30/2024 5:00:00 PM -to- 9/6/2024  5:00:00 PM | O 19835.25 | H 19918.25 | L 18572.5      | C 18693.5  | WeekCounter : 4
    Weekly Bar Processing : 9/6/2024  5:00:00 PM -to- 9/13/2024 5:00:00 PM | O 18634.75 | H 19812.25 | L 18622        | C 19765.5  | WeekCounter : 5
    Weekly Bar Processing : 9/13/2024 5:00:00 PM -to- 9/20/2024 5:00:00 PM | O 19734.25 | H 20201.75 | L 19529.25     | C 20028.25 | WeekCounter : 6
    Weekly Bar Processing : 9/20/2024 5:00:00 PM -to- 9/27/2024 5:00:00 PM | O 20039    | H 20537.75 | L 19952        | C 20221.5  | WeekCounter : 7
    
    Month Bars Processing :  8/30/2024 5:00:00 PM -to-  9/30/2024 5:00:00 PM | O 19835.25 | H 20537.75 | L 18572.5 | C 20261.25 | MonthCounter : 1
    Weekly Bar Processing :  9/27/2024 5:00:00 PM -to-  10/4/2024 5:00:00 PM | O 20198.25 | H 20331.5  | L 19818   | C 20227.25 | WeekCounter : 8
    Weekly Bar Processing :  10/4/2024 5:00:00 PM -to- 10/11/2024 5:00:00 PM | O 20219    | H 20508    | L 19902.5 | C 20450    | WeekCounter : 9
    Weekly Bar Processing : 10/11/2024 5:00:00 PM -to- 10/18/2024 5:00:00 PM | O 20433.75 | H 20680    | L 20205.25| C 20484.25 | WeekCounter : 10
    Weekly Bar Processing : 10/18/2024 5:00:00 PM -to- 10/25/2024 5:00:00 PM | O 20495.75 | H 20707.5  | L 20079   | C 20498.75 | WeekCounter : 11
    
    Month Bars Processing : 9/30/2024 5:00:00 PM -to- 10/31/2024 5:00:00 PM| O 20232 | H 20789.75 | L 19818| C 20021.75 | MonthCounter : 2
    
    Weekly Bar Processing : 10/25/2024 5:00:00 PM -to- 11/1/2024 5:00:00 PM | O 20524 | H 20789.75 | L 20007.75| C 20153.25| WeekCounter : 12
    
    
    ​
    Last edited by Kdevineni; 11-05-2024, 07:50 AM.

    #2
    Hello Kdevineni,

    There are likely going to be differences in data between providers and platforms, so the prices specifically may be different. With daily bars and greater, the trading hours are decided by the data provider, which may differ from provider to provider.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    558 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    324 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    101 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    546 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    547 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X