• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

2 Big issues when operating with simple prices, non-sense at all

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

    2 Big issues when operating with simple prices, non-sense at all

    Hi Ninjas,

    I've found apparently two important issues, which make my backtesting's results simply non-reliable, and don't know how to address them correctly. Before problem description, I work with NT version 7.0.1000.27.

    I work with EURUSD, which goes in half-ticks ( 0.00005 ), generally in range bars charts. Here the 2 issues:

    1. The result of simply operations like for example this: 2*Close[0]-Median[0]-Open[0] gives a number which is not in the exact format of half-pips , fix 5 digits after decimal point,BUT a number until 16 digits after decimal point, which it shouldn't be with this simply math. It seems the typical floating point problem, SO, in order to address it, I tried to use Math.Round(x,n) BUT then I came across with the other issue

    2. When I use Math.Round(x,16) ( until 16 digits after decimal point ) , then an error pops out when I run the backtesting:
    Error on calling 'OnBarUpdate' method for strategy 'STSdiffOriginal/daa2d411202e4d5cbde915766cd814c9': You are accessing an index with a value that is invalid since its out of range. I.E. accessing a series [barsAgo] with a value of 5 when there are only 4 Which is non-sense, because this Method has nothing to do with this message, besides my barsrequired are by far longer than used in the Algo.

    I've done several trials with and without Math.Round, with different digits, and the backesting results are just chaotic, not even close.

    I'd like you to address this problem, cause I can't work it out by my own.

    Looking forward for your help, thanks
    Last edited by pstrusi; 05-27-2015, 05:25 AM.

    #2
    2 ideas

    Try nt's round2ticksize function.
    And try a currentbar check if that doesn't help.

    Comment


      #3
      Hi pstrusi,

      The long double is coming from the Median.

      While when printed this is rounded, it is a calculation that is not a tick size.

      Try (2*Close[0]-Open[0]). Without the Median this should print to a tick size.

      From the help guide:
      Median price = (High + Low) / 2

      http://www.ninjatrader.com/support/h...nt7/median.htm

      This number is very seldom an actual tick size.


      Sledge has a good suggestion of using Instrument.MasterInstrument.Round2TickSize(). However, if you round the median, it will no longer be the median. Is this how you are intending to use this number?
      Chelsea B.NinjaTrader Customer Service

      Comment


        #4
        Hi Chelsea and Sledge, thanks for your responses and sugestions.

        As always when I find a partial solution, I post it:

        - I've realized that you have non-sense unexpected decimal numbers, when you do operations with variable of different types, for example: you do a simple math function with an integer and a double, and you're expecting a double number to come up. so, SUGGESTION: do math operations and comparisons with same type of variables.

        - Apply a solid logic and better to set parameters far enough to include the minimum difference in the right set of results
        Last edited by pstrusi; 05-27-2015, 07:11 AM.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by dadarara, Today, 12:18 PM
        0 responses
        2 views
        0 likes
        Last Post dadarara  
        Started by joemiller, Today, 07:33 AM
        0 responses
        7 views
        0 likes
        Last Post joemiller  
        Started by isnercrypto, Today, 06:42 AM
        0 responses
        4 views
        0 likes
        Last Post isnercrypto  
        Started by Coursocied67, Today, 04:02 AM
        0 responses
        5 views
        0 likes
        Last Post Coursocied67  
        Started by TheGameOfProbabilities, 07-18-2019, 06:56 AM
        7 responses
        37 views
        0 likes
        Last Post DaveS
        by DaveS
         
        Working...
        X