Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

I must be missing something obvious

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

    I must be missing something obvious

    I have the following simple function in my strat:
    privateint GetBarsAgoIdx(DateTime dt)
    {
    int rc = CurrentBar - Bars.GetBar(dt);
    return rc;
    }

    Pretty simple.

    I have a chart with my strat dropped on it and this function get's called with the following info taken from the immediate window in
    vstudio.

    ?dt.ToString()
    "8/26/2016 2:32:20 PM"
    ?Bars.GetBar(dt);
    282114
    ?CurrentBar
    3

    This means I get a -282111. How is this possible? I'm running 4-Range on ES. No way there's 300,000 bars since Friday. What on earth am I missing?
    Thanks ... Ed


    #2
    Hello edstaffin,

    Thank you for writing in.

    Can you please confirm the time frame settings that you have in your Data Series window?

    To do this, right-click on the chart and select Data Series.

    Additionally, have you added any additional series to your script?
    Zachary G.NinjaTrader Customer Service

    Comment


      #3
      Do you mean 4-Range (I mentioned this in my first post)? And no, no additional data series.
      Additionally, I found that CurrentBar == 3, Bars.Count == 282322, High.Count == Bars.Count, but if I try to access High[> 3] it barfs. I should also point out that this code works perfectly on a back test but falls short on an optimization.
      One last thing, I'm running it from 7/31/2014 forward.
      Thanks ... Ed
      Last edited by edstaffin; 08-30-2016, 03:49 PM.

      Comment


        #4
        Hello edstaffin,

        We will continue this through email.
        Zachary G.NinjaTrader Customer Service

        Comment


          #5
          NT uses a proprietary integer based date/time. Do you possibly need to use ToTime() to convert your windows style date / time value?

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by PhillT, Today, 02:16 PM
          2 responses
          6 views
          0 likes
          Last Post PhillT
          by PhillT
           
          Started by Kaledus, Today, 01:29 PM
          3 responses
          10 views
          0 likes
          Last Post NinjaTrader_Jesse  
          Started by frankthearm, Yesterday, 09:08 AM
          14 responses
          47 views
          0 likes
          Last Post NinjaTrader_Clayton  
          Started by gentlebenthebear, Today, 01:30 AM
          2 responses
          14 views
          0 likes
          Last Post gentlebenthebear  
          Started by PaulMohn, Today, 12:36 PM
          2 responses
          17 views
          0 likes
          Last Post PaulMohn  
          Working...
          X