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 RookieTrader, Today, 09:37 AM
          3 responses
          15 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Started by kulwinder73, Today, 10:31 AM
          0 responses
          5 views
          0 likes
          Last Post kulwinder73  
          Started by terofs, Yesterday, 04:18 PM
          1 response
          23 views
          0 likes
          Last Post terofs
          by terofs
           
          Started by CommonWhale, Today, 09:55 AM
          1 response
          4 views
          0 likes
          Last Post NinjaTrader_Erick  
          Started by Gerik, Today, 09:40 AM
          2 responses
          7 views
          0 likes
          Last Post Gerik
          by Gerik
           
          Working...
          X