Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

2nd position

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

    2nd position

    In my strategy I am trying to have 2 positions, both with a 6 tick stop, and one with a 3 tick target, the other with a 12 tick target. I used the following code, but only the first position (6 tick stop, 12 tick target) gets executed, the other postion is ignored. What do I need to do to get the strategy to recognize the second position?

    Thanks,

    Safetrading


    protectedoverridevoid Initialize()
    {
    SetProfitTarget(
    "Algo Long", CalculationMode.Ticks, 12);
    SetStopLoss(
    "Algo Long", CalculationMode.Ticks, 6, false);
    SetProfitTarget(
    "Algo Short", CalculationMode.Ticks, 12);
    SetStopLoss(
    "Algo Short", CalculationMode.Ticks, 6, false);


    SetProfitTarget(
    "Algo Long2", CalculationMode.Ticks, 3);
    SetStopLoss(
    "Algo Long2", CalculationMode.Ticks, 6, false);
    SetProfitTarget(
    "Algo Short2", CalculationMode.Ticks, 3);
    SetStopLoss(
    "Algo Short2", CalculationMode.Ticks, 6, false);


    CalculateOnBarClose =
    true;
    }

    #2
    Hello safetrading,

    Thank you for your note.

    What are you order handling options set to when you enable the strategy?

    What are the entries per direction and the Entry handling set to?
    MatthewNinjaTrader Product Management

    Comment


      #3
      reply

      I didn't think of this, my Order Handling is set like this;
      Entries per direction: 1
      Entry handling: AllEntries
      Exit on close: True
      Exit on close seconds: 30
      Stop & target submission: PerEntryExecution
      Sync account position: False

      Comment


        #4
        Please try running your strategy then with the EntryHandling set to allow 'UniqueEntries'.

        Comment


          #5
          reply

          I tried your suggestion, but the second position still did not execute. What else can I try?

          Comment


            #6
            You would then need to run the strategy with TraceOrders enabled in your Initialize() and check the output window if the order would then still be ignored even with the changed settings for multiple entries :

            Comment


              #7
              Reply

              I installed the following line in the Initialize section;
              TraceOrders = true;

              My Output window however, is only showing when the Strategy is Enabled or Disabled, it is not showing when orders are placed. Do I need other code to get this displayed?

              Comment


                #8
                It should show the order placement - please have the output window open and then reenable the strategy fresh - any place order commands seen then reported?

                Comment

                Latest Posts

                Collapse

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