Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Backtest Results Differ when using >=11 vs >12???

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

    Backtest Results Differ when using >=11 vs >12???

    Hi-

    Under a (BarsInProgress == 1) line, I have the following line:
    if (High[0] >= Position.AvgPrice + 12 * TickSize

    But if I change that line to:
    if(High[0] > Position.AvgPrice + 11 * TickSize

    Then I get very slightly different backtest results....

    Granted it only impacted 2 of 200 trades, nonetheless shouldn't the two lines return the same trades?


    #2
    Position.AvgPrice + 12 * TickSize
    is not equal to
    Position.AvgPrice + 11 * TickSize


    So why are you expecting the same results?

    Comment


      #3
      One is >=, while the other is simply >.

      Comment


        #4
        Originally posted by CoopGeko View Post
        One is >=, while the other is simply >.
        oops, sorry

        My guess is what you are experiencing is probably a rounding issue.
        Are you trading multiple contracts with differenty entries, so Position.AvgPrice can become a value in between 2 tick values ?

        Comment


          #5
          Originally posted by marcow View Post
          oops, sorry

          My guess is what you are experiencing is probably a rounding issue.
          Are you trading multiple contracts with differenty entries, so Position.AvgPrice can become a value in between 2 tick values ?

          Good point marcow, but no backtest it is only using a single lot, so either way it should be an interger....but I'll have to remember that distinction if I were trading multiple contracts.....

          Comment


            #6
            to exactly find out, you could also put a print statement inside the if-condition, which substracts the 2 and divides them by TickSize. As you stated, this theoretically should always be 1. But since it goes wrong 2 out of 200, the print statement should return something like 0.99 in these instances in the OutputWindow.
            That would explain why the > 11 TickSize is triggerd, but the >=12 Ticksize not.

            like
            Code:
             
            if (High[0] >= Position.AvgPrice + 12 * TickSize)
            PrintWithTimeStamp("" + ( (Position.AvgPrice + 12 * TickSize) -( Position.AvgPrice + 11 * TickSize ) ) / TickSize );

            Comment


              #7
              Thanks marcow.....how do I access the output of the print statement?

              And here probably is an easy question for you....

              How would I tell a strategy that the setup bar can't be an outside bar...the below code works great to require the last bar to BE an outside bar, but i don't know the correct way to specify that the last bar NOT be an outside bar.

              You can tell I'm pretty new at this, eh??!!!

              && High[0] > High[1]
              && Low[
              0] < Low[1]

              Comment


                #8
                Thanks marcow.....how do I access the output of the print statement?
                Control panel / Tools / OutputWindow


                Outside bar :
                ( High[0] > High[1] && Low[0] < Low[1] ) == true

                NOT Outside bar :
                ( High[0] > High[1] && Low[0] < Low[1] ) == false

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                0 responses
                656 views
                0 likes
                Last Post Geovanny Suaza  
                Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                0 responses
                371 views
                1 like
                Last Post Geovanny Suaza  
                Started by Mindset, 02-09-2026, 11:44 AM
                0 responses
                109 views
                0 likes
                Last Post Mindset
                by Mindset
                 
                Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                0 responses
                574 views
                1 like
                Last Post Geovanny Suaza  
                Started by RFrosty, 01-28-2026, 06:49 PM
                0 responses
                579 views
                1 like
                Last Post RFrosty
                by RFrosty
                 
                Working...
                X