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 Hwop38, 05-04-2026, 07:02 PM
            0 responses
            164 views
            0 likes
            Last Post Hwop38
            by Hwop38
             
            Started by CaptainJack, 04-24-2026, 11:07 PM
            0 responses
            317 views
            0 likes
            Last Post CaptainJack  
            Started by Mindset, 04-21-2026, 06:46 AM
            0 responses
            245 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by M4ndoo, 04-20-2026, 05:21 PM
            0 responses
            350 views
            0 likes
            Last Post M4ndoo
            by M4ndoo
             
            Started by M4ndoo, 04-19-2026, 05:54 PM
            0 responses
            179 views
            0 likes
            Last Post M4ndoo
            by M4ndoo
             
            Working...
            X