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 CarlTrading, 03-31-2026, 09:41 PM
            1 response
            78 views
            1 like
            Last Post NinjaTrader_ChelseaB  
            Started by CarlTrading, 04-01-2026, 02:41 AM
            0 responses
            40 views
            0 likes
            Last Post CarlTrading  
            Started by CaptainJack, 03-31-2026, 11:44 PM
            0 responses
            63 views
            2 likes
            Last Post CaptainJack  
            Started by CarlTrading, 03-30-2026, 11:51 AM
            0 responses
            63 views
            0 likes
            Last Post CarlTrading  
            Started by CarlTrading, 03-30-2026, 11:48 AM
            0 responses
            54 views
            0 likes
            Last Post CarlTrading  
            Working...
            X