Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Bars.GetBar Index

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

    Bars.GetBar Index

    Hello,

    from the NinjaTrader SampleGetHighLowByTimeRange I made me an indicator with different calculations and it works basically ok.

    I run the indicator on a 30 min chart. When I add Dataseries 15 min and I set eveything in the bracket if(BarsInProgress==1) then the startbarsago is not correct any more. I try to resolve this now for hours but I cant find a solution. After modifying and testing several times I have no idea what might cause this behavior.

    In parameters I have start time 9:30 and it works ok in 30 min chart. But when I add the dataseries 15 min and put it in BIP=1 then the starttime changes to 2:30 (I do no change in parameters!) And of course I change in the code all Low to Lows[1]/High....


    ???

    Thank you!
    Tony
    Last edited by tonynt; 12-03-2020, 01:29 AM. Reason: add info

    #2
    Hello Tony,

    Below is a link to the help guide for the .SampleGetHighLowByTimeRange.
    https://ninjatrader.com/support/help...est_high_o.htm

    When adding multiple series, specify the bar series you would like to get the bar by time from.

    BarsArray[0].GetBar().

    Below is a link to the help guide on BarsArray.
    https://ninjatrader.com/support/help.../barsarray.htm

    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hello,

      thank you for your reply.

      I attach a sample (reduced to the very minimum!) where you can see that it starts plotting from 2:30, even when parameters with start time 9:30.

      Thank you!
      Tony
      Attached Files

      Comment


        #4
        Hello Tony,

        There are no prints in this.

        How do you know that startDateTime has changed?

        Below is a link to a forum post that demonstrates using prints to understand behavior.
        https://ninjatrader.com/support/foru...121#post791121

        Print Times[0][0] and Times[1][1] and then print startDateTime.

        Provide the output saved to a text file if you are confirming that the startDateTime variable value is changing.

        As a heads up, it looks like you are getting the time from BarsArray[1]. That is not the chart bars. Meaning you are getting a bar from one series, and then drawing an object on a different series (the primary series, BarsArray[0]). Drawing objects are only drawn on the primary series.
        Chelsea B.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by nikorrriko, Today, 04:42 PM
        1 response
        9 views
        0 likes
        Last Post NinjaTrader_ThomasC  
        Started by rajeshks1988, Yesterday, 05:32 AM
        1 response
        16 views
        0 likes
        Last Post cincai
        by cincai
         
        Started by MaraAnkh, Yesterday, 08:44 PM
        1 response
        23 views
        0 likes
        Last Post cincai
        by cincai
         
        Started by [email protected], Today, 06:10 PM
        4 responses
        11 views
        0 likes
        Last Post bpatel20@gmail.com  
        Started by sgordet, Today, 02:24 PM
        0 responses
        14 views
        0 likes
        Last Post sgordet
        by sgordet
         
        Working...
        X