Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

bar length question

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

    bar length question

    Hi,

    I'm simply trying to calculate the "length" of a Candlestick bar (in "pips") using:

    BODY = (Math.Abs(Open[0] - Close[0])) * TickSize;

    This however is producing odd results (in Output Window)...what is the error in syntax here? I would think something like this is hardcoded into NT ("BarLength" for example) however I don't see it in the documentation...

    #2
    how about

    Math.Abs(High[0] - Low[0])

    this will give you the difference in Pips if sub pip is disabled otherwise 1/10ths of pips.
    RayNinjaTrader Customer Service

    Comment


      #3
      Thank you for the reply, still having problems, here is the line I'm using:

      BODY = Math.Abs(Open[0] - Close[0]);

      You can see from screenshots (2 periods, 12:30pm and 12:45pm) that what is being returned is not what should be expected (in pips)...I'm looking for the absolute value of the pips (thus .00039999 should be "4" pips)...I have no explanation for the information at 12:45pm.

      Also can you explain "sub pip disabling", I'm not familiar with it...
      Attached Files

      Comment


        #4
        then divide by TickSize and round to an integer value. Sub pip support is should be enabled (Tools > Options > Misc) when using data from MBT or IB for FX.
        RayNinjaTrader Customer Service

        Comment


          #5
          Thank you. I've enabled that sub pip and divided by TickSize. That seems to improve things. Can somebody supply an explanation why the pips seem to be multiples of 10? For example 4 pips is displaying as 40, 6 pips as 60, 22 pips as 220...etc...?

          Comment


            #6
            Since you are using sub-pips which prices are quoted in 1/10ths of pips, thus, divide by 10 you will get the pip value.
            RayNinjaTrader Customer Service

            Comment


              #7
              Thank you for your help.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
              0 responses
              605 views
              0 likes
              Last Post Geovanny Suaza  
              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
              0 responses
              351 views
              1 like
              Last Post Geovanny Suaza  
              Started by Mindset, 02-09-2026, 11:44 AM
              0 responses
              105 views
              0 likes
              Last Post Mindset
              by Mindset
               
              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
              0 responses
              560 views
              1 like
              Last Post Geovanny Suaza  
              Started by RFrosty, 01-28-2026, 06:49 PM
              0 responses
              561 views
              1 like
              Last Post RFrosty
              by RFrosty
               
              Working...
              X