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

A problem using multiple exits.

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

    A problem using multiple exits.

    Hi all,

    I am trying to develop a simple trading strategy using multiple exits, but i have a problem.

    If I write this code ( you can see the screen shot "A") and the system is = Marketposition.short , then NT only send a order.
    In this case NT only sends the order "ExitShortStop(MAX(Hihg,13)[0],"TrailingStop","");.

    The order "ExitShortStop(Position.AvPrice +- 50, "StopLoss", ""); do not work.

    What can i do to solve this ?...
    Thanks for your time and your help.

    Regards
    Attached Files

    #2
    Have you checked to see what the value of "Entries Per Direction" is?

    If this is set to 1, then clearly you won't be able to do two trades at a time.

    You can check this value in the strategy settings (see below).

    KBJ
    Attached Files

    Comment


      #3
      Please check out your log file for the error. I believe you will be seeing something about invalid stop price on your "Stop Loss" order which is why none of them work.

      When using a stop order to exit a short position your stop price needs to be above your Position.AvgPrice not below it. You should probably change your "Position.AvgPrice + -50" to maybe something like "Position.AvgPrice + 50". You may also find the property TickSize to be of value for you.

      The Entries Per Direction option KBJ talked about shouldn't affect you in this case. That option only affects orders for entry not for exits.

      Please also look into these methods as you might find them to your likings.
      SetTrailStop()
      SetStopLoss()
      SetProfitTarget()

      This reference sample will help you get familiar in using those methods.
      Last edited by NinjaTrader_JoshP; 10-25-2007, 01:06 AM.
      Josh P.NinjaTrader Customer Service

      Comment


        #4
        Hi all,

        Thanks for yor reply Josn and KBJ but the problem continuous.

        I am writing the next code (Called “NT”) and i have the same problem ( sorry for being wrong with the signs yesterday but this it was not the problem ).

        This is a rare problem, i was checking the log but i did not find anything about this order.(K1).

        If i run this strategy and the MarketPosition = Flat then Ninjatrader sends a order to entershort ( All is ok), but when this bar finishes only sends the order “K” Here is the problem.

        If i run this strategy and the MarketPosition = Short then Ninjatrader sends both orders. “K” and ”K1”. All works ok, but it is too much late.

        Josn , can you try this code on your computer ?...
        Thanks for your help and your time.

        Regards.


        Attached Files

        Comment


          #5
          Hi all,

          I am trying to solve this problem with SetStopLoss() but i have the same problem.

          I write the next code (Called "NS").

          The order OCO works ok , but when the bar finished Ninjatrader does not sends the Trailing Stop (ExitShortStop(Max(High,13)[0], "", "");

          What can i do ?
          Attached Files

          Comment


            #6
            I recommend you debug your strategy following this thread: http://www.ninjatrader-support.com/v...ead.php?t=3418

            In particular: please check out the TraceOrders option.

            Comment


              #7
              Right. You don't want to send Exit orders when MarketPosition is flat. There is no point. If you use TraceOrders as Dierk suggested it will say something about there being no position to exit.

              In regards to your use of SetStopLoss() along with ExitShortStop(), it works fine on my end. Please provide step-by-step reproducible scenario in which behavior you described occurs. If you run the strategy in a backtest and then look at the Orders tab of the Strategy Analyzer, orders with the name "Buy to cover" correspond with your ExitShortStop() order and orders with the name "Stop loss" correspond with your SetStopLoss().
              Josh P.NinjaTrader Customer Service

              Comment


                #8
                Hi all,

                Ok, I understad you.

                The problem is solved.

                Thank you for your patience and amiability.

                Regards.

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by bill2023, Yesterday, 08:21 AM
                2 responses
                14 views
                0 likes
                Last Post bill2023  
                Started by ynoldsany, Today, 01:00 AM
                0 responses
                3 views
                0 likes
                Last Post ynoldsany  
                Started by Carolscogginsi, Yesterday, 10:45 PM
                0 responses
                7 views
                0 likes
                Last Post Carolscogginsi  
                Started by RaddiFX, Yesterday, 10:15 AM
                2 responses
                15 views
                0 likes
                Last Post RaddiFX
                by RaddiFX
                 
                Started by patrickmlee007, Yesterday, 09:33 AM
                2 responses
                19 views
                0 likes
                Last Post patrickmlee007  
                Working...
                X