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

Using multiple entry/exit signals simultaneously

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

    Using multiple entry/exit signals simultaneously

    Thanks to Josh for posting the entry on Using multiple entry / exit signals simultaneously. His script created a fair bit of clarity for me and helped move my current strategy forward. This brings me to my question.

    The long strategy I am currently working on has 3 different entry conditions and 3 Different exit conditions. The Entries are labeled LEa, LEb, LEc.

    Things seem to be fine on the entry front, but I have a couple of quirks on the exit side I am trying to locate. One possibility might be in the way I coded the exit orders. They are as follows:

    if (Exit Condition 1 occurs ... Not the actual code)


    {
    ExitLongLimit(longExit1,
    "LX1", "LEa");
    ExitLongLimit(longExit1,
    "LX1", "LEb");
    ExitLongLimit(longExit1,
    "LX1", "LEc");
    }


    if (Exit Condition 2 occurs ... Not the actual code)

    {
    ExitLongLimit(longExit2,
    "LX2", "LEa");
    ExitLongLimit(longExit2,
    "LX2", "LEb");
    ExitLongLimit(longExit2,
    "LX2", "LEc");
    }


    if (Exit Condition 3 occurs ... Not the actual code)

    {
    ExitLongLimit(longExit3,
    "LX3", "LEa");
    ExitLongLimit(longExit3,
    "LX3", "LEb");
    ExitLongLimit(longExit3,
    "LX3", "LEc");
    }


    Here is my question: Does NinjaScript process all 3 exit conditions for all 3 Entry conditions? Let's say I am Long with 3 different positions LEa, LEb, and LEc. If Exit condition 2 occurs is there any reason all 3 long positions would not trigger an Exit long order at longExit2?

    When I test this in the sim account I seem to be getting sporadic exits and I am trying to narrow whether it is due to an error in my conditions or in the fashion I have grouped the multiple exit orders.

    Thanks for the help!!!

    Learning1


    #2
    You could be experiencing varying fill conditions. Just because one order was filled doesn't mean the other seemingly identical order will also be filled. If you are simply trying to close all open positions you can do so without any fromEntrySignal. Do something like
    Code:
    ExitLongLimit(100);
    where 100 is the limit price.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Thanks Josh. I am seeking to exit all open positions in the event any one of the 3 exit conditions are triggered. I gave this an attempt and I am not getting any limit exit orders submitted. (This may be due to a BarsInProgress issue as the exit conditions pull data from an additional timeframe).

      I previously was getting exit limit orders when each "exit from" was listed. Should ExitLongLimit work on all open positions(even those labelled)? Any other suggesitons?

      Thanks for the Help!

      Comment


        #4
        When you don't specify which one I believe it just kills all your open positions and tries to make you flat. Try a market order exit to see if your exit conditions are working. From what you are saying, it is not submitting any orders. Or is it simply not filling you?
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          If I do not specify each position ... i.e. ExitLongLimit(Target,LX1) - it does not submit a limit order.

          (I have not yet tried ExitLongLimit(Target,LX1,"")


          If I do specify each position ...
          ExitLongLimit(Target,LX1);
          ExitLongLimit(Target,LX2);
          ExitLongLimit(Target,LX3);
          It submits an exit order, but only seems to apply that order to the 1st Long Entry (LEa).
          If there are LEb and LEc positions open, the ExitLimitOrder does not resubmit. So the exit order seems to only apply to one open position even though all 3 are listed as actions when the condition is triggered.

          Comment


            #6
            Do not provide any signal name in your exit. You can see the various forms of syntaxing here http://www.ninjatrader-support.com/H...?ExitLongLimit.

            The reason you aren't getting orders is because the way you have it you are giving the limitPrice and then the fromEntrySignal. The problem is you don't have a fromEntrySignal named LX1.
            Josh P.NinjaTrader Customer Service

            Comment


              #7
              Thanks Josh. I think I get it. I'll try ExitLongLimit(Target,LX1,"").
              The reason for the LX1 is to ID which exit condition is triggering the order.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Fran888, 02-16-2024, 10:48 AM
              3 responses
              43 views
              0 likes
              Last Post Sam2515
              by Sam2515
               
              Started by martin70, 03-24-2023, 04:58 AM
              15 responses
              114 views
              0 likes
              Last Post NinjaTrader_Jesse  
              Started by The_Sec, Today, 02:29 PM
              1 response
              7 views
              0 likes
              Last Post NinjaTrader_Jesse  
              Started by jeronymite, 04-12-2024, 04:26 PM
              2 responses
              31 views
              0 likes
              Last Post NinjaTrader_BrandonH  
              Started by Mindset, 05-06-2023, 09:03 PM
              10 responses
              265 views
              0 likes
              Last Post NinjaTrader_BrandonH  
              Working...
              X