Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Strategy closes open position when getting a new signal

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

    Strategy closes open position when getting a new signal

    Hello everybody,
    I have a big problem in all my strategies. For example: I make a simple strategy for example to go long when the market touches EMA from above and go short when market touches EMA from below. When i run the strategy in Strategy Analyzer I see that whenever the strategy is in an open position (long or short) and it gets a new signal from market, it closes the open position and goes into new one. I would like to avoid this, so the strategy wouldn't react when is in open position and let this position to go to profittarget or stoploss.

    Can you please someone help me with that? I use Ninja Wizard only, I can't programme in a code, so please suggest a solution in Ninja Wizard (if there is one...)

    Thank you in advance, Josef

    #2
    Hello Pepca,

    Thanks for your post and welcome to the NinjaTrader forums!

    To prevent the opposite direction from closing the current position and opening a new one, add the condition that checks to see if the current market position is flat. In this way, a new position will only be opened if your previous position has been closed. You would need to add the check of the position in both the long and the short set that has the entry order.

    In the conditions window, click the "add" button to open the Condition Builder window. In the Conditions Builder window, on the left side select "Strategy" then choose "Current Market Position", in the center make sure the operator is set to "==", finally on the right side once again select "Strategy" and then choose "Flat", finally click OK to add the condition to your entry set. In the conditions window, the text should look like: Position.MarketPosition == MarketPosition.Flat Once you compile, reload your strategy and test for the results.
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Hello Paul,
      thank you so much. I completely missed that section of Ninja Wizard. Thank you very much!!!!

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by cmtjoancolmenero, Yesterday, 03:58 PM
      11 responses
      39 views
      0 likes
      Last Post cmtjoancolmenero  
      Started by FrazMann, Today, 11:21 AM
      0 responses
      5 views
      0 likes
      Last Post FrazMann  
      Started by geddyisodin, Yesterday, 05:20 AM
      8 responses
      52 views
      0 likes
      Last Post NinjaTrader_Gaby  
      Started by DayTradingDEMON, Today, 09:28 AM
      4 responses
      26 views
      0 likes
      Last Post DayTradingDEMON  
      Started by George21, Today, 10:07 AM
      1 response
      22 views
      0 likes
      Last Post NinjaTrader_ChristopherJ  
      Working...
      X