Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Position question

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

    Position question

    I am trying to use Position.MarketPosition == MarketPosition.Flat to control my order entries. In testing, I still get multiple entries in a strategy, so I added a print statement

    if (Position.MarketPosition == MarketPosition.Flat )
    { Print("Flat");}

    and it prints on every bar, even when I'm in a trade (long or short). Any ideas???

    #2
    Hi BradB not sure I follow - it should print 'Flat' when you are not having a position in this specific strategy. Can you please clarify what you mean by 'I still get multiple entries'? Also it would be helpful to see the code you used to comment. Thanks!

    Comment


      #3
      Ok, my point was, it also prints "Flat" when I do have an open position. It ALWAYS prints flat. By multiple entries, I mean... when I'm already in a position (long or short) and the strategy will submit another entry on a different bar if the setup occurs again. I'm trying to prevent this by using "Position.MarketPosition == MarketPosition.Flat" but it seems to have no effect.

      Comment


        #4
        Thanks Brad for this you need to set EntriesPerDirection to 1 - http://www.ninjatrader-support.com/H...Direction.html

        Comment


          #5
          I have that specified... THat still doesn't address why I can't get the market position to work correctly.

          Comment


            #6
            Brad, please post some sample code so I can advise you better, you might also want to look into the EntryHandling setting to enter only unique entries - http://www.ninjatrader-support.com/H...yHandling.html

            Comment


              #7
              Ok, I put together a quick sample strat to illustrate my point. In "tstsample", the orders pile up in the dome, with no regard to the orders already open. So, in "tstsaple2", I added the "Position.MarketPosition == MarketPosition.Flat" qualifier. I get the same result. I am obviously missing something here...
              Attached Files

              Comment


                #8
                Ok Brad, thanks for putting those together! Since you are calling ATM Strategies, please use this one for the ATM Market Position - http://www.ninjatrader-support.com/H...yPosition.html

                You can also review the SampleAtmStrategy provided by default with your NinjaTrader installation.

                Comment


                  #9
                  Ok, that seems to be the piece I was missing as it works fine, thanks

                  What I don't understand is, why did I even need to do that in the first place? What are the

                  EntriesPerDirection = 1;
                  EntryHandling = EntryHandling.AllEntries;

                  used for?

                  Comment


                    #10
                    Great!

                    EntriesPerDirection defines how many entries in the same direction are allowed.

                    The EntryHandling then defines if this is confined to unique entries (by signal names) or all entries.

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                    0 responses
                    558 views
                    0 likes
                    Last Post Geovanny Suaza  
                    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                    0 responses
                    324 views
                    1 like
                    Last Post Geovanny Suaza  
                    Started by Mindset, 02-09-2026, 11:44 AM
                    0 responses
                    101 views
                    0 likes
                    Last Post Mindset
                    by Mindset
                     
                    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                    0 responses
                    545 views
                    1 like
                    Last Post Geovanny Suaza  
                    Started by RFrosty, 01-28-2026, 06:49 PM
                    0 responses
                    547 views
                    1 like
                    Last Post RFrosty
                    by RFrosty
                     
                    Working...
                    X