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 timmbbo, Today, 08:59 AM
          1 response
          2 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Started by KennyK, 05-29-2017, 02:02 AM
          2 responses
          1,281 views
          0 likes
          Last Post marcus2300  
          Started by fernandobr, Today, 09:11 AM
          0 responses
          2 views
          0 likes
          Last Post fernandobr  
          Started by itrader46, Today, 09:04 AM
          1 response
          6 views
          0 likes
          Last Post NinjaTrader_Clayton  
          Started by bmartz, 03-12-2024, 06:12 AM
          5 responses
          33 views
          0 likes
          Last Post NinjaTrader_Zachary  
          Working...
          X