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 Mestor, 03-10-2023, 01:50 AM
      16 responses
      387 views
      0 likes
      Last Post z.franck  
      Started by rtwave, 04-12-2024, 09:30 AM
      4 responses
      31 views
      0 likes
      Last Post rtwave
      by rtwave
       
      Started by yertle, Yesterday, 08:38 AM
      7 responses
      29 views
      0 likes
      Last Post yertle
      by yertle
       
      Started by bmartz, 03-12-2024, 06:12 AM
      2 responses
      22 views
      0 likes
      Last Post bmartz
      by bmartz
       
      Started by funk10101, Today, 12:02 AM
      0 responses
      7 views
      0 likes
      Last Post funk10101  
      Working...
      X