No announcement yet.

Partner 728x90


Exit long positions on signal is not working as expected

  • Filter
  • Time
  • Show
Clear All
new posts

    Exit long positions on signal is not working as expected

    Hello, I'm having some trouble making sure my long positions are closed when a signal is given.

    See picture attached for reference, you can see the condition to exit on the right. The signal to exit is in the Yellow Circle, when a 90 HMA crosses below a 100 HMA. But only one position is exited (Yellow arrow), and the other was is not closed until later (Orange arrow).
    The only reason why the second position is closed is because I have a condition to exit long on a cross above the 70 Blue MA, BUT that is meant to be for profit taking. There are instances where the second position rides the market down WAY LONGER before being closed by another signal.

    To recap, I want ALL long positions to be exited at the Yellow circle, when the 90 HMA crosses below the 100HMA. I have 3 "Exit long" Actions in the strategy builder (see pic), I thought that would work, but it clearly doesn't, what am I doing wrong?

    Another solution would be to put a max stop loss on every long position of, let's say, 10 points, but I have not gotten that to work either in the "Stops and Targets" Section.

    Please, any help.

    Hello franco12364,

    Thanks for your post and welcome to the forums!

    It looks like you are using the same signal name of "buy". Typically an entry signal name is used to allow for different exits.

    If you do not have 3 separate entries with different signal names, I would suggest removing the signal name and only using one ExitLong(DefaultQuantity,"","") and this would exit all orders.

    If you want to use signal names to tie an entry to an exit and you have 3 orders then place three separate entry orders each with a different signal name and use the signal name in your stops and targets so each can have their own profit target and stop (which could be all the same value or different values). To exit everything, do not reference a signal name.

    for example

    if (some entry condition) then:
    EnterLong(DefaultQuantity, @"Myfirst")
    EnterLong(DefaultQuantity, @"MSecond")
    EnterLong(DefaultQuantity, @"MyThird")

    if (some exit condition) then
    ExitLong(DefaultQuantity,"","") // exit all orders

    SetProfitTarget(@"MyFirst", CalculationMode.Ticks, 10); // setting different profit targets for each
    SetProfitTarget(@"MySecond", CalculationMode.Ticks, 20);
    SetProfitTarget(@"MyThird", CalculationMode.Ticks, 30);

    SetStopLoss("", CalculationMode.Ticks, 10, false); // setting common stop loss (you can set individual here as well)

    You may want to review signal names under the "Managed Approach" section of the help guide, here is a link for your convenience to that section:
    Paul H.NinjaTrader Customer Service


      Paul, sorry for barging in in this post. I can't find the topic I'm looking for in all your posts and you are over your PM quota. Do you happen to have an NT8 version of the Al Brooks Bars add-on you made? The only one in the Eco System is for NT7.



        Thanks Paul, great answer.


          Hello bwolf,

          Thanks for your post.

          Yes, there is an NT8 version available in the NT user Apps of the NinjaTrader Ecosystem. At the top of this page, in the red banner are the words "User Apps", left click on that to get to the Ecosystems NT user apps section. Once there change the "show all" button" to "NinjaTrader 8 Indicators" to limit the selections, the indicator should be on the first page.
          Paul H.NinjaTrader Customer Service


          Latest Posts


          Topics Statistics Last Post
          Started by asgegre, Today, 03:07 AM
          0 responses
          Last Post asgegre
          by asgegre
          Started by MarkTee, Today, 02:53 AM
          0 responses
          1 view
          Last Post MarkTee
          by MarkTee
          Started by ldjaisohy, Today, 12:59 AM
          0 responses
          Last Post ldjaisohy  
          Started by TheCatTrader, Yesterday, 04:52 PM
          1 response
          Last Post s.kinra
          by s.kinra
          Started by oreameon, Today, 12:41 AM
          0 responses
          Last Post oreameon