Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to buy at the closing price on current bar?

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

    #46
    Peter,

    Yes, that is the way it goes. You can never tell whether the prices retraced or not. One should consider a few things with this method - but most of the times it is closer to your trigger point then next days open. A question: this method would require entering on a STOP. Can one use a formula as a stop value, or must it be a number?

    PS - There is indeed a mistake in the SMA calculation. Instead of C+X/20 is C+X.

    -geo-

    Comment


      #47
      Originally posted by geovani View Post
      Peter,

      ... A question: this method would require entering on a STOP. Can one use a formula as a stop value, or must it be a number?
      ...

      -geo-
      Yes, stops can be a formula. See the help file for EnterLongStop. The stop value is any floating point number, which can be any C# expression.

      Comment


        #48
        Peter, tx for the ideas. I am not studying ninjascript for the time being not out of laziness - really - but because I am full time occupied scripting a new strategy and indicators in another software, another language... so I just think it would be too much for this little old worn out brain to mix things....for now.

        rgds

        -geo-

        Comment


          #49
          I posted a quick hack to fill market orders at the current bar's close (rather than the next bar's open) here:

          Comment


            #50
            @r2kTrader, to clarify: Josh reply is accurate as it relates to the fill logic which was discussed earlier.

            Comment


              #51
              r2kTrader,

              Please do not take the statement out of context. This whole thread has been discussing fill algorithms.
              Josh P.NinjaTrader Customer Service

              Comment


                #52
                Originally posted by NinjaTrader_Josh View Post
                r2kTrader,

                Please do not take the statement out of context. This whole thread has been discussing fill algorithms.
                Josh,

                I deleted my messages.

                I can't see this going anywhere positive.

                Comment


                  #53
                  r2kTrader,

                  I have added your suggestion for unrealized drawdown tracking onto our list of future considerations.
                  Josh P.NinjaTrader Customer Service

                  Comment


                    #54
                    Josh,

                    I will cross my fingers. Key for developmental purposes.

                    Thank you for the consideration.

                    In the meantime, is there anything I can do to get the unrealized draw downs? I am not asking for the solution, rather direction to finding my own. How would you skin this cat knowing what you know.

                    Thank you in advance,


                    r2kTrader

                    Comment


                      #55
                      r2kTrader,

                      You can run your own DD tracking with Unrealized PnL as the trade progresses. You know your entry price, just keep checking it against the Low[0] price. If it goes lower save that difference. At the end of the trade you can then calculate out your local max DD for that trade.

                      Keep a tracker on the overall strategy max DD as well then at the end you can print it out to the Output Window or anywhere you want.
                      Josh P.NinjaTrader Customer Service

                      Comment


                        #56
                        Originally posted by NinjaTrader_Josh View Post
                        r2kTrader,

                        You can run your own DD tracking with Unrealized PnL as the trade progresses. You know your entry price, just keep checking it against the Low[0] price. If it goes lower save that difference. At the end of the trade you can then calculate out your local max DD for that trade.

                        Keep a tracker on the overall strategy max DD as well then at the end you can print it out to the Output Window or anywhere you want.
                        Thank you for the helpful reply.

                        I don't want to fill up the forum thread off topic, but I was unable to Private Message you.

                        QUESTION: Could I just find out the value after I exited the trade?

                        I know the Fill price and the time, and I know the Exit price and time. Couldn't I just say, what was the lowest low / highest high (based on position obviously) between FillPriceTime and ExitPriceTime?

                        Would that be less intensive? Or am I missing something?

                        Comment


                          #57
                          You could, but I would assume it is relatively the same calculation. You still need to cycle through every bar in a loop within that range to check for the lows and store it out as you reach each one.
                          Josh P.NinjaTrader Customer Service

                          Comment


                            #58
                            Josh,

                            Do you know if there is anyone who has done a backtesting Class that we could use for customized backtesting?

                            If not, would it be possible to allocate a section for this or a proper static thread of somekind?

                            It could certainly provide a great source of feedback and ideas for backtesting stats.




                            Thanks,


                            r2kTrader

                            Originally posted by NinjaTrader_Josh View Post
                            You could, but I would assume it is relatively the same calculation. You still need to cycle through every bar in a loop within that range to check for the lows and store it out as you reach each one.

                            Comment


                              #59
                              There is a optimizer class implementing a genetic optimizer here:

                              It has some quirks and it a bit of a hack, but it works much better than the built-in optimizer, for many types of more involved backtests.

                              I have made some enhancements to this genetic optimizer that I'll try and post later. NT7 will supposedly include a built-in genetic optimizer (possibly derived from this one?).

                              Comment


                                #60
                                Sorry r2kTrader. Not sure what you are looking for exactly.
                                Josh P.NinjaTrader Customer Service

                                Comment

                                Latest Posts

                                Collapse

                                Topics Statistics Last Post
                                Started by NullPointStrategies, Yesterday, 05:17 AM
                                0 responses
                                63 views
                                0 likes
                                Last Post NullPointStrategies  
                                Started by argusthome, 03-08-2026, 10:06 AM
                                0 responses
                                139 views
                                0 likes
                                Last Post argusthome  
                                Started by NabilKhattabi, 03-06-2026, 11:18 AM
                                0 responses
                                75 views
                                0 likes
                                Last Post NabilKhattabi  
                                Started by Deep42, 03-06-2026, 12:28 AM
                                0 responses
                                45 views
                                0 likes
                                Last Post Deep42
                                by Deep42
                                 
                                Started by TheRealMorford, 03-05-2026, 06:15 PM
                                0 responses
                                50 views
                                0 likes
                                Last Post TheRealMorford  
                                Working...
                                X