Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Always-On Limit Order

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

    Always-On Limit Order

    Hello,

    I would like to create a strategy that places a limit order at the bottom of a Bollinger band then changes the limit order price as the bottom band changes. When the order is executed, the strategy would be off, until the stock was sold and it would run again.

    I prefer not to wait for a cross-over or a signal to place the order, but would rather always have the limit order live.

    Is something like this possible? If so, can you please point me in the right direction?

    Thanks!

    Andrew

    #2
    Andrew, welcome to our forums, you could use a snippet like this below -

    Code:
     
    if (Position.MarketPosition == MarketPosition.Flat)
    EnterLongLimit(Instrument.MasterInstrument.Round2TickSize(Bollinger(2, 20).Lower[0]), "BBDLowerEntry");
    This would submit an order at the lower to ticksize rounded Bollinger Band price until filled, as per default a limit order in NinjaScript would last for one bar update only.

    Comment


      #3
      Thank You

      Thank you very much. I'll try it out this morning. Am loving NinjaTrader so far.

      Comment


        #4
        Its Working

        Truly remarkable. Thank you so very much!

        Comment


          #5
          Not working now

          Hi,

          Ok, so it worked when I first started the strategy in the strategy tab. Then I restarted NT, and now each time I start the strategy it immediately reflects Unrealized profit and never enters an actual order at the bottom of the bollinger band.

          Any ideas?

          Thanks in advance.

          Andrew

          Comment


            #6
            This is the virtual position you're strategy is in historically, as you perhaps did not set any exits yet, right?

            There're two modes to startup a NinjaScript strategy as detailed here ('On starting a realtime strategy') -

            Comment


              #7
              Settings

              Ok. Thanks. I am using the default setting on the Strategies->NinjaScript screen which match the ones on the help document you sent over. Is there something I should change? There are no actual open orders in the account.

              Comment


                #8
                Yes, this is expected in this mode the historical position from the stratey is 'taken over' into realtime trading, thus synching in the account has to occur manually -



                Our next release NinjaTrader 7 will allow for auto synching of strategy vs account positions -

                Comment


                  #9
                  Confused

                  Hi,

                  I really do appreciate your help.

                  I am new to this though, and just don't understand. I have read and reread the references you sent over.

                  I have no active positions in the account. None. I don't understand what kind of order I would have to place in order to get the strategy to run. Everytime I start it, it reports an unrealized p&L - even when it report a "-" for the position of that P&L.

                  Sure love any help you could provide. It was wonderful to see the strategy working, not extremely frustrating to not be able to ever get it working again.

                  Andrew

                  Comment


                    #10
                    You're welcome - if you restart the strategy it would recalculate it's historical postion, for example a long taken earlier today.

                    Since you work in the 'immediately submit' mode, the strategy 'thinks' it's long since this point in time, thus you see 'unrealized PnL' for this strategy position listed.

                    However your live / sim account does not hold this position, thus the synching is 'off' - a manual trade needs to be placed to reestablish this (in this case here a long for the same qty the strategy position is showing).

                    In case you wonder wh you don't see more trades > you would need to add exit conditions as well, or use a higher EntriesPerDirection setting -

                    Comment


                      #11
                      Still Confused

                      Hi,

                      This is the only strategy that I want to run with NT. It doesn't matter to me what 'mode' I am on. At this point everything on the options screen means absolutely nothing to me. The mode was set by default. If there is a different mode I could be working on please let me know.

                      I don't want the strategy to ever sell anything. It is only designed to place a buy order for me at the bottom of the bollinger bands. I tried changing the EntrysPerDirection to 10,000 - and it still won't place an order.

                      I am trading on a live account. I can't manually enter sell orders because I don't actually own the stock that it thinks that I purchased in the strategy.

                      Any help would really be appreciated. I am happy to pay for help on this too. I purchased the lifetime license to NT yesterday just to be able to implement this strategy.

                      Thanks

                      Andrew

                      Comment


                        #12
                        Andrew,

                        To keep things very simple just do this.

                        Tools>Options>Strategies>NinjaScript Strategies>select "Wait until flat". Then before you start your strategy ensure your account is flat for the instrument the strategy is going to be trading on. Then you will have no problems with your strategy processing trades. It will wait till the strategy position is flat before submitting a real trade to your account. At that point in time it will work since they will be in sync at a flat state.
                        Josh P.NinjaTrader Customer Service

                        Comment


                          #13
                          Same Thing

                          Once again, I appreciate the help.

                          Unfortunately, I am still have the same result. By "flat" my assumption is that you mean that there are no open position and no active outstanding orders, right?

                          The strategy hows a position of "-" and a unrealized price of "$816.00"

                          I use MB Trading with a data coming from IQ Feed, if that helps at all.

                          Any other ideas?

                          Comment


                            #14
                            That is the strategy position and it is a virtual position not related to your account. When you use "Wait until flat" it means it will only continue doing virtual trades till the strategy position reaches flat. At that point in time the strategy position will be in sync with the account position and any future trades initiated by the strategy will be live trades.

                            By flat on the account I mean no open positions and no active orders.
                            Josh P.NinjaTrader Customer Service

                            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