Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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 Stanfillirenfro, Today, 07:23 AM
              1 response
              2 views
              0 likes
              Last Post NinjaTrader_Gaby  
              Started by cmtjoancolmenero, Yesterday, 03:58 PM
              2 responses
              19 views
              0 likes
              Last Post cmtjoancolmenero  
              Started by olisav57, Yesterday, 07:39 PM
              1 response
              9 views
              0 likes
              Last Post NinjaTrader_ChelseaB  
              Started by cocoescala, 10-12-2018, 11:02 PM
              7 responses
              943 views
              0 likes
              Last Post Jquiroz1975  
              Started by oviejo, Today, 12:28 AM
              1 response
              12 views
              0 likes
              Last Post NinjaTrader_Gaby  
              Working...
              X