Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

no entry

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

    no entry

    Hello,
    I try to code that no entry within a strategy is realized when another position is open. EG I go long with 3 contracts and scale out with different profit targets and I want to code that no new entry is realized as long as one of the current positions is not closed (even when the entry conditions are filled - but this might be no issue if there is a clear coding for "noentry" maybe)
    Thanks for help.
    Tony
    Last edited by tonynt; 08-07-2010, 02:58 PM. Reason: forgot

    #2
    tonynt, perhaps you could check the Position.MarketPosition property when running your entry logic, and if Position.MarketPosition != MarketPosition.Flat, do not enter the position:
    Code:
    if (entryConditions == true && Position.MarketPosition == MarketPosition.Flat)
        EnterLong/Short();
    AustinNinjaTrader Customer Service

    Comment


      #3
      market position not flat - no entry

      Thank you for reply.

      In the meantime I solved this by using a variable to be set to a certain value referring to market position. Sorry, with your solution can you please explain if you mean to write your "if (entryConditions...." after my conditions? Eg when conditions would be MACDcrossaboveAVG - where to write this? And "EnterLong/Short()" without "{" ,"}" here?
      Thanks
      Tony


      Originally posted by NinjaTrader_Austin View Post
      tonynt, perhaps you could check the Position.MarketPosition property when running your entry logic, and if Position.MarketPosition != MarketPosition.Flat, do not enter the position:
      Code:
      if (entryConditions == true && Position.MarketPosition == MarketPosition.Flat)
          EnterLong/Short();

      Comment


        #4
        Tony, this was just demo snippet by Austin outlining the general structure you would need to use, you can just directly add the MarketPosition check to your entry conditions defined, for example if you act on the MACD cross -

        Code:
         
        if (CrossAbove(MACD(10, 20, 5), MACD(10, 20, 5).Avg, 1) && Position.MarketPosition == MarketPosition.Flat)
        EnterLong();

        Comment


          #5
          Thank you!

          Originally posted by NinjaTrader_Bertrand View Post
          Tony, this was just demo snippet by Austin outlining the general structure you would need to use, you can just directly add the MarketPosition check to your entry conditions defined, for example if you act on the MACD cross -

          Code:
           
          if (CrossAbove(MACD(10, 20, 5), MACD(10, 20, 5).Avg, 1) && Position.MarketPosition == MarketPosition.Flat)
          EnterLong();

          Comment

          Latest Posts

          Collapse

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