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

Multiple profit target levels

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

    Multiple profit target levels

    Hi,
    I am trying to enter short position with 3 contract (Stop Limit) with 3 profit target levels, each one of them buy 1 contract,
    When running the strategy, the first target works OK but the 2 other and also the stop loss dont work any more.
    What is the problem ?

    This is the entry command:
    EnterShortStopLimit(3, (Low[0] - TickSize), Low[0], "Short");

    and these are the profit targets and stop loss command:

    ExitShortLimit(0, true, 1, _profitPrice1, "ProfitShort", "Short");
    ExitShortLimit(0, true, 1, _profitPrice2, "ProfitShort", "Short");
    ExitShortLimit(0, true, 1, _profitPrice3, "ProfitShort", "Short");
    ExitShortStopMarket(0, true, 3, _stopPrice, "StopShort", "Short");

    Thanks

    #2
    Hello yaniv,

    Thanks for your post.

    Each of the ExitShortLimit orders will need a unique name. You are using "ProfitShort" on all three so the system would assume you are placing one order and then changing price 2 times.

    Make each exit a unique exit name.

    If your stop order is not working then check your "log" tab of the NinjaTrader control center for any related error messages. You may need to verify that the variable "_stopPrice" is the correct value for the order.

    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Hi,
      Thanks
      I did it and still the same,
      When I had only one take profit level and one stop loss, when one of them achieved, the other have canceled (like OCO), and that is what happening also now,
      The first profit target level achieved and the other profit target levels and the stop loss have cancelled.
      How can I change this behavior ?

      Click image for larger version

Name:	Capture.JPG
Views:	375
Size:	76.4 KB
ID:	1166716
      Thanks

      Comment


        #4
        Hello yaniv,

        Thanks for your reply.

        To accomplish your goal you will need to create 3 entry orders of 1 contract each and each with a unique entry name.

        For each entry, you need to also create a separate profit and stop order tied to the entry by its signal name.

        To illustrate, entry:

        EnterShortStopLimit(1, (Low[0]-TickSize), Low[0], "Shorta");
        EnterShortStopLimit(1, (Low[0]-TickSize), Low[0], "Shortb");
        EnterShortStopLimit(1, (Low[0]-TickSize), Low[0], "Shortc");

        To illustrate, exits:

        ExitShortLimit(0, true, 1, Position.AveragePrice - 15 * TickSize, "ProfitShorta", "Shorta");
        ExitShortLimit(0, true, 1, Position.AveragePrice - 20 * TickSize, "ProfitShortb", "Shortb");
        ExitShortLimit(0, true, 1, Position.AveragePrice - 30 * TickSize, "ProfitShortc", "Shortc");
        ExitShortStopMarket(0, true, 1, Position.AveragePrice + 30 * TickSize, "StopShorta", "Shorta");
        ExitShortStopMarket(0, true, 1, Position.AveragePrice + 30 * TickSize, "StopShortb", "Shortb");
        ExitShortStopMarket(0, true, 1, Position.AveragePrice + 30 * TickSize, "StopShortc", "Shortc");
        Paul H.NinjaTrader Customer Service

        Comment


          #5
          Hi,
          Thanks
          So, if I want to buy 100 contracts, I need to send 100 separate commands ???
          I can not send one command for entry and exit in two or more different prices from the same entry ?

          Thanks

          Comment


            #6
            Hello yaniv,

            Thanks for your reply.

            The bottom line is that separate entries would be needed for separate stops/targets.

            If you had 100 different targets and or stops then yes you would need 100 different entries.

            if you only have 3 targets then just 3 orders of 33, 33, and 34 would be needed.



            Paul H.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Barry Milan, Yesterday, 10:35 PM
            5 responses
            16 views
            0 likes
            Last Post NinjaTrader_Manfred  
            Started by DanielSanMartin, Yesterday, 02:37 PM
            2 responses
            13 views
            0 likes
            Last Post DanielSanMartin  
            Started by DJ888, 04-16-2024, 06:09 PM
            4 responses
            12 views
            0 likes
            Last Post DJ888
            by DJ888
             
            Started by terofs, Today, 04:18 PM
            0 responses
            11 views
            0 likes
            Last Post terofs
            by terofs
             
            Started by nandhumca, Today, 03:41 PM
            0 responses
            8 views
            0 likes
            Last Post nandhumca  
            Working...
            X