Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

ExitLong, ExitShort

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

    ExitLong, ExitShort

    Hello,

    in the video library there is the syntax for exitlong described as

    ExitLong(int quantity, string signalName, string fromEntrySignal)

    and for having plotted on the chart which position-exit it is I code eg

    ExitLong("1", "Exit1", "Long1")

    but when compiling I then get the error message with "...overload...invalid arguments..."

    Why?

    PS: ExitLong("1", "Long1") works but with this I don´t see which position is closed. However, in the video-library the syntax is shown so it shouldn´t be a problem on my needs.

    Thanks
    Tony

    #2
    Tony, when specifying the quantity, there can't be quotations around the number or the compiler will interpret the number incorrectly.
    Code:
    // this works:
    ExitLong(1, "Exit1", "Long1");
    
    // this doesn't:
    ExitLong("1", "Exit1", "Long1");
    Please let me know if you have any other questions.
    AustinNinjaTrader Customer Service

    Comment


      #3
      Austin,

      thank you! This was really a ridiculous mistake. Sorry!

      But at this opportunity I want to ask another question - I hope I do not make error like this again:

      * when I do a strategy with the wizard I can select if stoploss simulated or not, but how do I have to code this? (I could find in the video library only a description but not how to write in a strategy)

      Thanks
      Tony

      Comment


        #4
        Tony, currently the only method to simulate stops in code is with the SetStopLoss() method. For example, to do a $200 simulated stop loss, you could do this:
        Code:
        SetStopLoss(200, true);
        AustinNinjaTrader Customer Service

        Comment


          #5
          Hello,

          sorry, maybe I did the question not correctly. How to code for NOT having simulated - as I want to have the stops not in "stealth mode" but on brokers server?

          Thanks
          Tony
          Last edited by tonynt; 05-08-2011, 11:03 PM. Reason: forgot "?"

          Comment


            #6
            Tony, if you set simulated to false, the second parameter in Austin's snippet, then your stoploss order would rest at the broker / exchange it not part of an OCO exit strategy where the target is sent first and thus the stop locally simulated by NT.

            Comment


              #7
              What about trailing stops? Are they always simulated on the local PC, or are they on the broker's server?

              Comment


                #8
                The same considerations would apply koganam, for example SetTrailStop is using the same order type (StopMarket order) as SetStopLoss.

                Comment


                  #9
                  Hello,

                  in videolibrary there was only sample setstoploss(500), that´s all. Therefore I missed it maybe. However, I got it now, thanks.


                  But what I don´t understand now is " .... IF (?) not part of an OCO...". So, when it´s part of an OCO then it´s always simulated?


                  Best
                  Tony


                  Originally posted by NinjaTrader_Bertrand View Post
                  Tony, if you set simulated to false, the second parameter in Austin's snippet, then your stoploss order would rest at the broker / exchange it not part of an OCO exit strategy where the target is sent first and thus the stop locally simulated by NT.

                  Comment


                    #10
                    Tony, if you have for example a Profit Target also working in this strategy > this would be sent to the broker and the stop would rest locally, in this case the OCO feature is locally simulated by NinjaTrader, which is how it works for most connections we offer.

                    Note: This information is relevant for NinjaTrader 7 only. For NinjaTrader 8, please click here (https://ninjatrader.com/support/helpGuides/nt8/where_do_your_orders_reside_.htm). CQG Orders in a state "Accepted" or "Working" are at the exchange. If the exchange does not support a specific order type, the

                    Comment


                      #11
                      Originally posted by NinjaTrader_Bertrand View Post
                      Tony, if you have for example a Profit Target also working in this strategy > this would be sent to the broker and the stop would rest locally, in this case the OCO feature is locally simulated by NinjaTrader, which is how it works for most connections we offer.

                      http://www.ninjatrader.com/support/f...ead.php?t=5349
                      So then basically if you have an active OCO order in a position and NinjaTrader crashes, you now have no protective stop order and need to call in and have the broker take you flat (or at least take whatever action one needs to take to protect one's account) ? Did I get that correct?

                      Comment


                        #12
                        Hello,

                        This is correct in the case of the broker not supporting stop orders. However most brokers support stop orders on their servers, it is usually the OCO functionality they don’t support. For example when your stop loss gets hit then your profit target would not automatically be cancelled if NinjaTrader wasn’t connected to see the stop loss get hit.

                        For more information on this:

                        Where do orders reside:
                        Note: This information is relevant for NinjaTrader 7 only. For NinjaTrader 8, please click here (https://ninjatrader.com/support/helpGuides/nt8/where_do_your_orders_reside_.htm). CQG Orders in a state "Accepted" or "Working" are at the exchange. If the exchange does not support a specific order type, the



                        I look forward to assisting you further.
                        BrettNinjaTrader Product Management

                        Comment


                          #13
                          Brett, that is what is confusing me, because what you just wrote contradicts what NinjaTrader_Bertrand wrote 2 replies up.

                          He implies that for OCO bracket orders, the target order is what is on the broker's server, while the stop order is local, while you seem to be saying that the stop is on the broker's server while the target is local.

                          Incidentally, I was under the impression that what you said was the correct one, but now I am not so sure anymore. Would you be kind enough to clarify, and be sure that we are all on the same page?

                          Thanks.

                          Comment


                            #14
                            Hello,

                            This all depends on where your orders reside and is different ber connection technology. The list shows what orders are located where.

                            1) All limit orders are always at the market on all connections. The profit target is a limit order so this is always submitted to the broker.

                            2) Most brokers but not all support stop orders. If the broker supports stop order per the link then the stop order is also on the brokers server. If the broker does not support stop orders on there side then the stop order is local on NinjaTrader side. (Bert Response)

                            3) Finally there is OCO linking, for when the profit target or stop gets hit that the associated stop loss or profit target is cancelled. This is also listed on the link I sent you if its broker or locally simulated.

                            Let me know if something else still isnt clear. I'd be happy to give you a call if you email me to support at ninjatrader dot com ATTN: Brett

                            Also, by the way great work on your responses on the forum. I know a lot of people appreciate it.

                            Let me know if I can be of further assistance.
                            BrettNinjaTrader Product Management

                            Comment

                            Latest Posts

                            Collapse

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