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

    #16
    Hi geo, just save it as a .png and click on 'Manage Attachment' when you reply to my post, then attach it there. Thanks!

    Comment


      #17
      I hope the pictures will show.
      One trade was generated.

      Tx

      -geo-
      Attached Files

      Comment


        #18
        Geo, sorry my previous screenshot was wrong - this should work, you have to use the MAX() for realizing your trade entry breakout condition. Please adjust in your strategy and let me know if it helps!
        Attached Files

        Comment


          #19
          No trades yet.
          I will send you the pictures - its a bit slow now...

          -geo-

          Comment


            #20
            Ok, just let me know after monitoring it today.

            Comment


              #21
              Im doing a print-screen, pasting on paint, saving as .png
              Is there an easyer way to send pictures?
              Attached Files

              Comment


                #22
                No Geo, that's the way to go. You posted just your ExitLong condition 2 times, which looks alright.

                Comment


                  #23
                  I have tried several simple systems with some indicators... and such. all worked, but cant make the breakout one work...

                  Here is the entry picture.

                  If you find the error please let me know.

                  Tx

                  -geo-
                  Attached Files

                  Comment


                    #24
                    Your condition will never evaluate to true.

                    High[0] compared to MAX(High, 5)[0]. MAX(High, 5)[0] gives you the highest high over the last 5 bars. High[0] is included in the MAX() check. If it is in the check it will be impossible for High[0] to be greater than MAX(). If it was the highest it would be the MAX().
                    Josh P.NinjaTrader Customer Service

                    Comment


                      #25
                      Of course. I realized it when I tried to program the same thing in another soft. If you change the condition > to >= and the other <= it works alright.

                      Tx

                      -geo-

                      Comment


                        #26
                        OK...now we come back to the original question. NT is triggering alright but it is buying in the open of the next bar. Now....this delay is not nescessary. I want to enter the trade the moment it crosses the highest high of the past 5 days - in the very same day it crosses and at the very same price. There is no logical impediment for it, so there must be a way.

                        Is that possible?

                        -geo-

                        Comment


                          #27
                          As we have discussed geo, you have the close price of the bar. With the close price your bar is closed. That means the bar is final. You cannot make any trades on that bar so you trade on the open of the next bar.
                          Josh P.NinjaTrader Customer Service

                          Comment


                            #28
                            Josh, now we must talk very seriously :>)))

                            I could agree with the fact that indicators "close" their value with the close of the bar. But if my system is about crossing a certain value - that is quite different!!

                            If the present bar is crossing a certain threshold, a certain value, be it an EMA, or SMA, or HHV of a previous bar, there is absolutely no logical impediment to execute the triggered order at the present bar and at the
                            price where the crossing occurred. I agree that the price could have crossed it 10 times forth and back - but it HAS crossed it at that precise value. Where is the impediment?

                            The impossibility to program NT to do that IS a serious problem - so much that I still believe that through scripting it MUST be possible to do it.

                            Again: indicator calculations are made at the close of the bar, but crossings???? No. There must be a way to solve this. If not now...in some future edition of NT.

                            Consider STOPS. If prices "CROSS" a STOP today will I not be triggered out of the trade? Well then...why not when prices cross an EMA?

                            I am not talking about the "picture" of the candle being crossed by an EMA. That is past, fixed and can not be changed. What I am talking about is about the capacity of NT to calculate and signal entries at the precise crossing point. We are backtesting. That calculation is done AFTER the closing of the present bar. The arrow is positioned there after the bar is closed - and it should not be a problem.

                            rgds

                            -geo-

                            Comment


                              #29
                              Geo,

                              Crossings, indicator values, bar values, everything else, during a backtest, all are evaluated at the close of the bar. As discussed several times already, NinjaTrader will always take the most conservative approach possible. You cannot trade at the close price in a backtest.

                              If you want real-time behavior just run forward tests and skip the backtesting. The fact of the matter is that this is the nature of backtesting. Any behavior otherwise is "cheating" and NinjaTrader disallows this to prevent overstating of performance. Unfortunately I cannot devote any more resources discussing this point.
                              Josh P.NinjaTrader Customer Service

                              Comment


                                #30
                                Josh,

                                I understand that you cannot devote any more resources discussing this point. No problem, really. We will not talk this over again.
                                I am not speaking out of my elbows - as we say over here - meaning that I am not some discussion lover.... or something like that. I have been studying, analyzing and trading systems of all kinds for many years now. My present conclusion is that in no way can one put all situations and circumstances in one single basket.
                                -- Opening a position at close is not allowed because in the final 5 or 3 or 10 or 1 minute the market may change and indicators may move abruptly. OK, agreed.
                                -- Price crossing a previous high is FINAL. It is an irrevocable, unchangeable, absolute fact. Not only that, but the exact point of crossing can be precisely pinpointed.
                                There is no cheating in it. As the bar closes and the tester sees that there was a crossing it exits you at that price because that is what you would do in real life trading.
                                Back testing means testing the past. It is looking into the near or distant past. The tester may look into the last bar and see the crossing point - in the past, just like any other past events in the chart. Just as it exits you if prices fall bellow your Stop-Loss trigger. What is the difference? Where is the cheating?

                                Sorry if I am being so insistent...maybe the result of a touch of disappointment. I still believe that this can be somehow be overcome through scripting.

                                rgds

                                -geo-

                                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