Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Exit long positions on signal is not working as expected

Collapse
X
 
  • 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.

    #2
    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: https://ninjatrader.com/support/help...d_approach.htm
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      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,
      Wolf.

      Comment


        #4
        Thanks Paul, great answer.

        Comment


          #5
          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

          Comment

          Latest Posts

          Collapse

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