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

Rounding error on Euro

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

    Rounding error on Euro

    It seems there is a rounding error when doing OHLC calculations with the euro.

    Here I print out the Close & Open, the same value is printed.

    Then I print out Close - Open, which shows they're not equal exactly.

    Code:
    12/7/2009 3:31:13 AM C=1.4831 O=1.4831
    12/7/2009 3:31:13 AM C-O=-4.44089209850063E-16
    Here's the code:

    Code:
                    Print(Time[0] + " C=" + Close[0] + " O=" + Open[0]);
                    Print(Time[0] + " C-O=" + (Close[0] - Open[0]));
    Any way to get around this problem? It's really messing me up.

    #2
    Which broker / feed and which Pip settings are you using?

    Have you tried casting the values to doubles for example and then substracting?

    Also please check into this link below -



    Thanks
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_Bertrand View Post
      Which broker / feed and which Pip settings are you using?

      Have you tried casting the values to doubles for example and then substracting?

      Also please check into this link below -



      Thanks
      I can't believe you just answered my question in less than a few minutes on a holiday weekend. You guys are amazing. Thank you very much.

      This worked:

      Code:
      Instrument.MasterInstrument.Compare(Close[1],Open[1]) == -1
      I just realized that if I press F5 on my chart to update the indicators, it seems to erase my annotations that are off screen. Is this possible? I'm trying to figure it out. in the meantime I use Control-I and then press close and that seems to be ok.

      Comment


        #4
        Hi cunparis, thanks for the kind words great this helped - where are those annotations placed, sorry not following you here...
        BertrandNinjaTrader Customer Service

        Comment


          #5
          Originally posted by NinjaTrader_Bertrand View Post
          Hi cunparis, thanks for the kind words great this helped - where are those annotations placed, sorry not following you here...
          I drew on my chart, hit F5, and then noticed my drawings were gone. It could be that I did something else but it happened several times and I just started using F5. I went back to control-I close and haven't lost a drawing since.

          it seems to happen to the drawings that are not visible (like from a previous day).

          Comment


            #6
            Thanks cunparis - unfortunately wasn't able to see if happening in my testing so far...
            BertrandNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by AttiM, 02-14-2024, 05:20 PM
            12 responses
            213 views
            0 likes
            Last Post DrakeiJosh  
            Started by cre8able, 02-11-2023, 05:43 PM
            3 responses
            238 views
            0 likes
            Last Post rhubear
            by rhubear
             
            Started by frslvr, 04-11-2024, 07:26 AM
            8 responses
            117 views
            1 like
            Last Post NinjaTrader_BrandonH  
            Started by stafe, 04-15-2024, 08:34 PM
            10 responses
            47 views
            0 likes
            Last Post stafe
            by stafe
             
            Started by rocketman7, Today, 09:41 AM
            3 responses
            12 views
            0 likes
            Last Post NinjaTrader_Jesse  
            Working...
            X