Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to Only Enter When Flat?

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

    How to Only Enter When Flat?

    I have need test to see if my positions are Flat before entering a new "FullTrade". My scripted logic is to enter 3 uniquely named trades with 3 different targets and 3 stops. These are OCO, so the Full Stop cancels all. I call each of the 3 partial trades a "Leg" (e.g. Leg1, Leg2, Leg3).

    My question is: In code, how can I avoid entering any additional "FullTrades" when I have a "FullTrade" position on?

    My trades are entered in OnBarUpdate(). My targets and stops are adjusted in OnPositionUpdate().

    In Initialize() I have:
    EntriesPerDirection = 3;
    EntryHandling = EntryHandling.AllEntries;

    Most "FullTrades" work fine, but whenever one "Leg" has hit it's target, I can find myself entering a new trade if the conditions are right.

    IPosition doesn't seem to be available in OnBarUpdate() and OnPositionUpdate is too late. Will I need to track this on my own with additional variables? (Hopefully not, but possible.)

    What are your thoughts?

    Brian

    #2
    if (Position.MarketPosition == MarketPosition.Flat
    && .....

    Not sure if that answers the question regarding your specific strategy but thats what I use in mine.

    Comment


      #3
      Can you not just set some variables to signify a "state" and reset this to a "fresh" state once the position is flat which then signals you can take new "legs" ?
      RayNinjaTrader Customer Service

      Comment


        #4
        Thanks for the quick response(s).

        Elliot ... I do that too, but only in the OnPositionUpdate(). I wasn't able to get it to work when I first tried it in OnBarUpdate(). Compiled now, so it may be working now. Thanks very much.

        Ray ... ya, that's what I was going to do, if nothing else. I might need to go ahead a set my own class up for my 3-legs in a "FullTrade" anyway. Thanks.

        Much appreciated,

        Brian

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        650 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        370 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
        577 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X