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

decimal logic breach

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

    decimal logic breach

    NG 60 minute bar series created highest variable prints correctly at 3.054 via an added array TEST60highestPrice = Highs[2][1];
    Testing for if the last one minute bar closes above this level after the one hour mark gives a Close[0] value of 3.029 which falsely enters an order via
    && Close[0]>TEST60highestPrice .

    Clearly the TEST60highestPrice > Close[0] value and should not fire, but upon running a print check:

    Print((Close[0] - TEST60highestPrice); it prints 0.025 which should clearly be a negative value.

    How can 3.029 - 3.054 = +0.025????

    regards to all.
    Last edited by elliot5; 09-29-2020, 06:12 AM.

    #2
    Hello elliot5, thanks for posting.

    More information should be printed out here. What is the exact value of Close[0] and TEST60highestPrice? Try printing both of those individually to find why it's getting that difference.

    Best regards.
    Chris L.NinjaTrader Customer Service

    Comment


      #3
      The two print out values were stated above.
      Close[0] = 3.029
      TEST60highestPrice 3.054.

      When using trade execution logic of: && Close[0]>TEST60highestPrice

      the trade fires when clearly that is false.

      Print((Close[0] - TEST60highestPrice) resulted in a print of 0.0029 SHOULD BE NEGATIVE!
      .

      Comment


        #4
        Hello elliot5, thanks for your reply.

        Printing out: Print(3.029 - 3.054); is negative on my test. The only thing that would prevent a number from being negative is if the holding variable is unsigned.

        Do you have a test script I could try out? Please also let me know the exact data point you are looking at.

        I look forward to hearing from you.
        Chris L.NinjaTrader Customer Service

        Comment


          #5
          Apologies for the delayed reply. The cause was simple variable calculation error. Resolved and glad it was not a bug. Regards and many thanks

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by lightsun47, Today, 03:51 PM
          0 responses
          4 views
          0 likes
          Last Post lightsun47  
          Started by 00nevest, Today, 02:27 PM
          1 response
          8 views
          0 likes
          Last Post 00nevest  
          Started by futtrader, 04-21-2024, 01:50 AM
          4 responses
          44 views
          0 likes
          Last Post futtrader  
          Started by Option Whisperer, Today, 09:55 AM
          1 response
          13 views
          0 likes
          Last Post bltdavid  
          Started by port119, Today, 02:43 PM
          0 responses
          9 views
          0 likes
          Last Post port119
          by port119
           
          Working...
          X