Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Auto BE +1 Problem

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

    #16
    Hi advs108,

    When considering your condition, simply add 1 to the index to indicate that you are referring to the bar before.

    Use Close[1] to indicate you are referring to the close of previous full bar.
    TimNinjaTrader Customer Service

    Comment


      #17
      Hi,

      Hummm, I'm not sure to understand that correctly.... My order should be sent at the close of the current bar, 2 ticks above/below the high/low...

      I don't really see where I should enter that....
      Do you mind have a look at the file attached and tell me where I should put that "past bar" reference ?

      All the best.
      Attached Files

      Comment


        #18
        Hi advs108,

        If you are using FirstTickOfBar, and want to submit at the price of the close of the current bar + 2, you can do something like...
        Code:
        if (FirstTickOfBar) 
        { 
            if (your conditions here) 
            EnterLongStop(Close[1] + 2*TickSize)
        }
        TimNinjaTrader Customer Service

        Comment


          #19
          Ok, here's what I did :

          Code:
          EnterLongStop(nbcontracts, High[1] + bufferentry * TickSize, "WIISignalLong1");
          But, still enter on the wrong bar, too early
          Please have a look at the picture attached. The entry point should be at the close of the bar with the vertical line (signal bar), 2 ticks above. Bar matching the 3rd green bar on the indicator, in the ellipse....
          For now the order is sent when the "signal bar" open, 2 ticks above the high of the previous bar....

          How can I correct that ?
          Thx
          Attached Files

          Comment


            #20
            Hi advs108,

            What are your conditions for this entry?
            This is live and with COBC = false correct?
            TimNinjaTrader Customer Service

            Comment


              #21
              CalculateOnBarClose = false yes, correct.

              I probably made a mistake in the logic calculation.... But I can't find it !

              If you want to have a look at the code, I attached the file...
              Thx !!
              Attached Files

              Comment


                #22
                Hi,

                You will need to track your bool statement, watching to see if they are being set at the correct times. You already have Print("Three is true") for example. Consider adding Print(CurrentBar) or Print(Time[0]) to see if they are being set correctly, then debug from there.
                TimNinjaTrader Customer Service

                Comment


                  #23
                  Hey !

                  when it print time, it give me the time when the current bar will close.
                  For example, I'm using a 3 min chart, when the current bar open it is 04:42 and the print at bar open is :
                  One is false
                  5541
                  2010-06-10 16:45
                  Two is false
                  5541
                  2010-06-10 16:45
                  Three is false
                  5541
                  2010-06-10 16:45
                  Four is false
                  5541

                  So, what does this mean ? I'm totally lost !

                  Comment


                    #24
                    Hi advs108,

                    These are the time stamps of the bar, and represent the end of the bar. With you mouse or crosshair, hover over the bar with the data box open to see the time stamp.
                    TimNinjaTrader Customer Service

                    Comment


                      #25
                      Yes, I know that.....

                      So, what I can see is that everything in terms of boolean is good. it is only the order which is submitted at the open of the bar and not at bar close....
                      Isn't it ?
                      How can I tell the strat to submit the order at bar close ?

                      Here's an output of an order entry, all the conditions are good, I just want the order to be submitted when this bar will close... How can I do that ?

                      One is false
                      5551
                      2010-06-10 17:15
                      Two is false
                      5551
                      2010-06-10 17:15
                      Three is false
                      5551
                      2010-06-10 17:15
                      Four is true
                      5551
                      2010-06-10 17:15
                      2010-06-10 17:12 Entered internal SetStopTarget() method: Type=Stop FromEntrySignal='' Mode=Ticks Value=12 Currency=0 Simulated=False
                      Reset of stop loss
                      no long
                      Short
                      2010-06-10 17:15

                      Comment


                        #26
                        Hello Advs108,

                        There is no way to place orders at the close of a bar.

                        With COBC = true: Order are placed at the next bar open following the condition.

                        With COBC = false: Orders are placed whenever conditions evaluate to true. Only available in real-time (not backtest.)
                        Ryan M.NinjaTrader Customer Service

                        Comment


                          #27
                          One quick question :
                          The order submitted by my strat is cancelled if not filled at bar close. How can I keep it waiting one more bar ?
                          Thank you very much.

                          Comment


                            #28
                            Originally posted by NinjaTrader_RyanM View Post
                            Hello Advs108,

                            There is no way to place orders at the close of a bar.

                            With COBC = true: Order are placed at the next bar open following the condition.

                            With COBC = false: Orders are placed whenever conditions evaluate to true. Only available in real-time (not backtest.)
                            Yes, Ryan...
                            The purpose of this thread was to learn how to submit entry orders at bar close, but to allow a break even +1 in real time, intra bar, as soon as the price reach my break even level....
                            Tim seems to think that it is possible....

                            So, is that possible or not possible ?

                            You can find the code as an attached file.... If you want to have a look at it......
                            Attached Files
                            Last edited by advs108; 06-10-2010, 04:01 PM.

                            Comment


                              #29
                              advs108,

                              This requires working with the advanced overload for these order methods and setting liveUntilCanceled to true.

                              Example below for EnterLongStop();

                              EnterLongStop(int barsInProgressIndex, bool liveUntilCancelled, int quantity, double stopPrice,string signalName)

                              When using this overload and liveUntilCanceled, you'll also have to use IOrder objects and issue CancelOrder() commands according to your conditions for canceling. The reference sample below can help with this:
                              When using NinjaTrader's Enter() and Exit() methods, the default behavior is to automatically expire them at the end of a bar unless they are resubmitted to keep them alive. Sometimes you may want more flexibility in this behavior and wish to submit orders as live-until-cancelled. When orders are submitted as live-until
                              Ryan M.NinjaTrader Customer Service

                              Comment


                                #30
                                Thank you for your answer Ryan. I'll read that.

                                And concerning my previous post, is it possible or not possible to do the submit at bar close and the BE+1 thing intra bar ?

                                Originally posted by advs108 View Post
                                Yes, Ryan...
                                The purpose of this thread was to learn how to submit entry orders at bar close, but to allow a break even +1 in real time, intra bar, as soon as the price reach my break even level....
                                Tim seems to think that it is possible....

                                So, is that possible or not possible ?

                                You can find the code as an attached file.... If you want to have a look at it......

                                Comment

                                Latest Posts

                                Collapse

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