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 bortz, 11-06-2023, 08:04 AM
          47 responses
          1,611 views
          0 likes
          Last Post aligator  
          Started by jaybedreamin, Today, 05:56 PM
          0 responses
          9 views
          0 likes
          Last Post jaybedreamin  
          Started by DJ888, 04-16-2024, 06:09 PM
          6 responses
          19 views
          0 likes
          Last Post DJ888
          by DJ888
           
          Started by Jon17, Today, 04:33 PM
          0 responses
          6 views
          0 likes
          Last Post Jon17
          by Jon17
           
          Started by Javierw.ok, Today, 04:12 PM
          0 responses
          22 views
          0 likes
          Last Post Javierw.ok  
          Working...
          X