Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Multiple Entries, Multiple Targets

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

    Multiple Entries, Multiple Targets

    I am looking for some guidance on how to handle the order management of an automated strategy.

    Upon entry conditions I have 3 entries in the same direction. I have a defined target and stop for each based on the size of the current candle.
    Upon the first target being hit, I would like to move the other 2 stops to break even.
    When a target is hit I want to remove the associated stop order.
    If the stops are hit I want to remove the targets.

    I cant do this in an ATM because I want to make the targets and stops based on the size of the candle, so it is different each time.
    Price may move to the first target in the middle of a candle, so I want to move the stops right then.

    Do I need to use an unmanaged approach?
    I can get 3 orders to be placed with a stop and a target but I am having trouble moving the stops to BE after the the first target is hit once they are set.
    I am having trouble identifying individual orders to move intra-bar even though have given them specific names..
    Is there a better way or a sample of code you could offer to help guide me?




    #2
    Hello cpabiz20k,

    When using the managed approach use unique signal names for each entry, attach the exits to the entries by matching the fromEntrySignal, and set the EntryHandling to UniqueEntries.

    Below is a link to an example.


    Or yes, you could use the unmanaged approach instead of you want.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      So that was great, thank you. I now have multiple entries with stops and targets working. I am not able to figure out how to get target2 and target3 to break even when target1 has hit the price level.

      I am trying to set a condition where if price is ever equal to or great than the first target, move both stops to BE. I am wondering if the issue here is that I am using a 3 minute candle and the target might get hit in the first minute, then go back and take out the other 2 stops, and they did not move to BE because the candle did not close for the program to loop through again.
      Any thoughts on how to handle this?

      Comment


        #4
        Hello cpabiz20k,

        Set the trigger distance for the logic of that order to the distance of the first target.

        Below is a link to example code for breakeven or custom trailing. (Condition sets for each signal name separately)
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Thanks for all of your help. It is working and backtesting as originally planned. The way it is now it loops OnBarUpdate, which means that the breakeven only occurs at the close of a candle. I am using a 3 minute candle and would like to be able to move the stop immediately upon being hit, rather than wait for the close of the candle. Any ideas about how to do this? Do I need to add a tick series or something?

          Comment


            #6
            Hello cpabiz20k,

            You are wanting intra-bar actions?

            You will need 1-tick intra-bar granularity for intra-bar fills, and TickReplay to use Calculate.OnPriceChange in historical.
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              how did you define 3 entries with single condition/signal?

              Comment


                #8
                Hello Snoopy_trader,

                Welcome to the NinjaTrader forums!

                In OnStateChange();
                EntriesPerDirection = 3;

                In OnBarUpdate():
                if (/* condition to enter here*/)
                {
                EnterLong("longEntry1");
                EnterLong("longEntry2");
                EnterLong("longEntry3");
                }

                Have a look at the ScaleOutBuilderExample linked in post # 2.
                Chelsea B.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by NullPointStrategies, Yesterday, 05:17 AM
                0 responses
                64 views
                0 likes
                Last Post NullPointStrategies  
                Started by argusthome, 03-08-2026, 10:06 AM
                0 responses
                139 views
                0 likes
                Last Post argusthome  
                Started by NabilKhattabi, 03-06-2026, 11:18 AM
                0 responses
                75 views
                0 likes
                Last Post NabilKhattabi  
                Started by Deep42, 03-06-2026, 12:28 AM
                0 responses
                45 views
                0 likes
                Last Post Deep42
                by Deep42
                 
                Started by TheRealMorford, 03-05-2026, 06:15 PM
                0 responses
                50 views
                0 likes
                Last Post TheRealMorford  
                Working...
                X