Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Prices not rounded in backtest results

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

    #16
    Austin,

    just wanted to ask if you have tested the strategy I attached in the first post.

    Like you, I also do not see the un-rounded prices when using the SampleMACrossover strategy, and the data is going to be impossible to send - my email server only allows me to send less than a small number of MB - I think's it only 5.

    So my opinion is that the next easiest step would be for you to load up my strategy and settings and see what you get.

    Thanks

    Comment


      #17
      adamus,

      A lot of places in your code you are doing things like "trailStop = Position.AvgPrice + stopPoints;" where stopPoints is just a decimal. If you are trying to add something to the price you should figure it out in terms of ticks and then do it like this:

      trailStop = Position.AvgPrice + someInt * TickSize;

      Please try sending values that are properly rounded to ticksize instead of some abstract number.
      Josh P.NinjaTrader Customer Service

      Comment


        #18
        Aha! Paradigm click!

        I assumed that the EnterLong(randomDecimal) or EnterShort(randomDecimal) would automatically round off the given 'randomDecimal' to the nearest tradable tick value.

        Is there already a function which will do this in NinjaScript? Presumably not, since you're not suggesting one.

        I need to get the tick size of the instrument being traded - could you give me a hint?

        Thanks


        ps how about Position.AvgPrice - is this value rounded off to the nearest tick?

        Comment


          #19
          The property "TickSize" will be the tick size of your instrument.

          Position.AvgPrice is not necessarily rounded depending on if you got partial fills or not.

          To round values to TickSize you can use this: http://www.ninjatrader-support.com/H...Round2TickSize
          Josh P.NinjaTrader Customer Service

          Comment


            #20
            Works like a charm!

            Thanks v much

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            597 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            343 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            103 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            556 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            555 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X