Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

ExitLong() used multiple times

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

    ExitLong() used multiple times

    Dear Ninjatrader,

    I have a strategy that uses market order entry combined with limit order exits for stop loss and profit target.

    As I am using a different datafeed for charting, and a different one for executing through my broker, I want to use entirely market orders.

    My Entry:
    So I compare current price with my ray-price and then enter using EnterLong() or EnterShort().

    Then I have a 50% profit line, that exits half of my position using the ExitLong() or ExitShort() functions.

    How do I exit my 2:nd profit line using ExitShort() or ExitLong(), it does not seem to work, and I am forced to use ExitShortLimit(currentprice) instead of just ExistShort() when the price reaches my final profit target price.

    Is there a limitation in NT7 on how many times you can use the ExitShort() or ExitLong() function????

    #2
    Hello Warcious,

    Thank you for your note.

    If you’d like to enter a position and scale out, ˝ at 1 condition and ˝ at the next, what you could do is define the quantity of the exits. For example use EnterShort(2) to enter a position selling 2 contracts at the market. Then under your exit conditions you would use ExitShort(1) and ExitShort(1), which would take off 1 contract, 2 times.

    Please let us know if you need further assistance.
    Alan P.NinjaTrader Customer Service

    Comment


      #3
      I have tried everything, and I simply do not know why my code will not execute my ExitShort() or ExitLong() a second time in the strategy, despite that the strategy state is NOT flat, and we are still in postition after only selling half of the position using a previous 50% profit target line using ExitShort() or ExitLong() already. It is very strange!

      Is there some kind of other functions that may prevent ExitLong() or ExitShort() from working a 2nd time if the strategy state is NOT flat and we are still in position?

      Comment


        #4
        Originally posted by warcious View Post
        Dear Ninjatrader,

        I have a strategy that uses market order entry combined with limit order exits for stop loss and profit target.

        As I am using a different datafeed for charting, and a different one for executing through my broker, I want to use entirely market orders.

        My Entry:
        So I compare current price with my ray-price and then enter using EnterLong() or EnterShort().

        Then I have a 50% profit line, that exits half of my position using the ExitLong() or ExitShort() functions.

        How do I exit my 2:nd profit line using ExitShort() or ExitLong(), it does not seem to work, and I am forced to use ExitShortLimit(currentprice) instead of just ExistShort() when the price reaches my final profit target price.

        Is there a limitation in NT7 on how many times you can use the ExitShort() or ExitLong() function????
        All the gritty details. You might want to read the entire thread.

        ref: http://ninjatrader.com/support/forum...63&postcount=1

        Comment


          #5
          Or do I understand that I should use SubmitOrder() insted of ExitLong() or ExitShort() to deliver a market order ?

          Comment


            #6
            koganam,

            Thanks again!
            I used SubmitOrder() for all my orders in my strategy and it is WORKING.
            But I had to disable managed orders by entering Unmanaged = true, in the Initialize() function.

            Question:
            Are there any important things I have to consider if I disable managed orders, or is it just that instead of using EnterShort(), EnterLong(), ExitShortStop(), ExitShortLimit(), ExitLongStop(), ExitLongLimit(), etc. now I can only use SubmitOrder() and define all parameters as needed/I want ?`

            No other limitations?

            Thanks again!

            Cheers!

            Comment


              #7
              Originally posted by warcious View Post
              koganam,

              Thanks again!
              I used SubmitOrder() for all my orders in my strategy and it is WORKING.
              But I had to disable managed orders by entering Unmanaged = true, in the Initialize() function.

              Question:
              Are there any important things I have to consider if I disable managed orders, or is it just that instead of using EnterShort(), EnterLong(), ExitShortStop(), ExitShortLimit(), ExitLongStop(), ExitLongLimit(), etc. now I can only use SubmitOrder() and define all parameters as needed/I want ?`

              No other limitations?

              Thanks again!

              Cheers!
              Whoa there. Careful does it!

              "Unmanaged" means exactly what it says: you are totally on your own. Every safety guard that NT has placed in "Managed" trade mode is non-existent: you must handle everything yourself.

              You really do want to RTF(ine)Manual, and make sure that you know what you are doing. It is not just a matter of changing a few order entry types.

              ref: http://ninjatrader.com/support/helpG...d_approach.htm

              Comment


                #8
                Hello Warcious,

                Koganam is correct in regards to his warning about the unmanaged approach (thank you Koganam). There is a lot of considerations to consider when going unmanaged for which you can find more information at the link he provided.



                An alternative which would be under the managed approach and would allow the scaling out of your position, would be to break up your entry orders and uniquely name them.

                For example, rather than using,

                EnterLong(3);

                You should use,

                EnterLong(1,"Long A");
                EnterLong(1, "Long B");
                EnterLong(1, "Long C")

                Which would then allow you to scale out via,

                ExitLong("Long A");
                ExitLong("Long B");
                ExitLong("Long C");

                Please let us know if you need further assistance.
                Alan P.NinjaTrader Customer Service

                Comment


                  #9
                  Koganam, NinjaTrader_AlanP,

                  Thank you for your input, that is why I do NOT want to use the unmanaged approach and must get it to work using the managed approach.

                  Unfortunately, I do not get the scaling in approach with entry names defined working as you suggested, and only the first EnterLong() is being filled. I can only see "Long A" being filled in my Control Center, and it ignores the other lines of code using EnterLong(2, "Long B"), etc,,

                  EnterLong(1,"Long A");
                  EnterLong(1, "Long B");
                  EnterLong(1, "Long C")

                  The scaling in most work, before I can tell if my scaling out is working.

                  Comment


                    #10
                    Originally posted by warcious View Post
                    Koganam, NinjaTrader_AlanP,

                    Thank you for your input, that is why I do NOT want to use the unmanaged approach and must get it to work using the managed approach.

                    Unfortunately, I do not get the scaling in approach with entry names defined working as you suggested, and only the first EnterLong() is being filled. I can only see "Long A" being filled in my Control Center, and it ignores the other lines of code using EnterLong(2, "Long B"), etc,,

                    EnterLong(1,"Long A");
                    EnterLong(1, "Long B");
                    EnterLong(1, "Long C")

                    The scaling in most work, before I can tell if my scaling out is working.
                    Look up EntriesPerDirection and EntryHandling in the NT documentation and be sure that you are using values appropriate for what you want to do.

                    Comment


                      #11
                      Koganam,

                      Again, thank you for a very prompt and accurate reply. I am testing EntryHandling.AllEntries &
                      EntryHandling.UniqueEntries right now.

                      But I am not sure I understand the difference between these 2 parameter settings.

                      My strategy works as this:
                      I open my strategy and based on my selected ray-lines I have a ENTRY line, PROFIT LINE, and STOP LOSS line. I could also activate a 50% Profit Target line, BEFORE my ENTRY line is being triggered, or DURING my trade. What I mean by during, is that I am already in position and suddenly I enable my 50% Profit target line, it appears and exits my position by "Position.Quanity / 2", when the 50% Profit target line is triggered.

                      What is the difference between EntryHandling = EntryHandling.UniqueEntries and EntryHandling = EntryHandling.AllEntries, when EntriesPerDirection = 1 or =2 ?

                      Example 1:
                      EntriesPerDirection = 2;
                      EntryHandling = EntryHandling.UniqueEntries;
                      and
                      EnterLong(1, "Long A");
                      EnterLong(1, "Long B");
                      EnterLong(1, "Long A");

                      Here, my unique entry with name "Long A" is ONLY being executed ONE TIME, and I thought it should be executed twice due to my EntriesPerDirection = 2. Am I missing something here?

                      when I set my order entries like this:
                      EnterLong(2, "Long A");
                      EnterLong(2, "Long B");
                      EnterLong(3, "Long C");
                      THEN all 3 Entry orders are being executed. ?!?


                      Example 2:
                      EntriesPerDirection = 1;
                      EntryHandling = EntryHandling.AllEntries;
                      and
                      EnterLong(2, "Long A");
                      EnterLong(2, "Long B");
                      EnterLong(3, "Long C");

                      Here, only the first EnterLong(1, "Long A) was executed, and no other EnterLong() rows where executed. BUT, when I change >EntriesPerDirection = 2< setting, then "LONG A" and "LONG B" are being executed, but NOT the second "LONG A".

                      BUT, when I change EntriesPerDirection = 2, then "Long A" and "Long B" is being executed, but NOT "Long C".

                      So, what is an UniqueEntry ?? It seems that the parameter EntryHandling.AllEntries and EntryHandling.UniqueEntries works exactly the same.

                      I still do not fully comprehend this! Its probably a minor detail I am missing.

                      Thanks!
                      Last edited by warcious; 10-02-2016, 09:18 PM.

                      Comment


                        #12
                        Originally posted by warcious View Post

                        BUT, when I change EntriesPerDirection = 2, then "Long A" and "Long B" is being executed, but NOT "Long C".



                        Thanks!
                        Change to 3.

                        Code:
                        EntriesPerDirection = 3;

                        Comment


                          #13
                          Yes I know, but what I am asking is important for understanding how NT is handling all my entries:
                          What is the difference between
                          "EntryHandling = EntryHandling.UniqueEntries;"
                          and
                          "EntryHandling = EntryHandling.AllEntries;" ?

                          they both treat my Entries the same.

                          Comment


                            #14
                            Originally posted by warcious View Post
                            Yes I know, but what I am asking is important for understanding how NT is handling all my entries:
                            What is the difference between
                            "EntryHandling = EntryHandling.UniqueEntries;"
                            and
                            "EntryHandling = EntryHandling.AllEntries;" ?

                            they both treat my Entries the same.
                            They do not. There is a nuance that you are missing. EntryHandling.UniqueEntries means that you may make a number of separate entries using the same name, not that it will. Your code path will determine what will happen.

                            EntryHandling.AllEntries means that you may enter as many trades as determined by that number, regardless of their names. When the aggregate number of trades reaches that number, you may not enter any more trades, regardless their name.

                            So if you have more named orders than the entries you have specified, the two directives may appear to be acting the same, depending on how your code is written.

                            Actually in this case, I think that the examples in the NT documentation make this quite clear.

                            Comment


                              #15
                              Examine the example in the reply to this post.


                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                              0 responses
                              569 views
                              0 likes
                              Last Post Geovanny Suaza  
                              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                              0 responses
                              330 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by Mindset, 02-09-2026, 11:44 AM
                              0 responses
                              101 views
                              0 likes
                              Last Post Mindset
                              by Mindset
                               
                              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                              0 responses
                              548 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by RFrosty, 01-28-2026, 06:49 PM
                              0 responses
                              548 views
                              1 like
                              Last Post RFrosty
                              by RFrosty
                               
                              Working...
                              X