• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

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 TikDaddy, Today, 02:08 PM
      2 responses
      7 views
      0 likes
      Last Post NinjaTrader_JoshG  
      Started by Brillo, Today, 01:52 PM
      1 response
      13 views
      0 likes
      Last Post NinjaTrader_Jim  
      Started by TazoTodua, 02-09-2018, 08:40 AM
      10 responses
      880 views
      0 likes
      Last Post NinjaTrader_JoshG  
      Started by TazoTodua, Yesterday, 04:35 AM
      6 responses
      18 views
      0 likes
      Last Post eDanny
      by eDanny
       
      Started by MattP, Today, 12:25 PM
      1 response
      6 views
      0 likes
      Last Post NinjaTrader_PatrickG  
      Working...
      X