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 CarlTrading, 03-31-2026, 09:41 PM
                1 response
                68 views
                0 likes
                Last Post NinjaTrader_ChelseaB  
                Started by CarlTrading, 04-01-2026, 02:41 AM
                0 responses
                36 views
                0 likes
                Last Post CarlTrading  
                Started by CaptainJack, 03-31-2026, 11:44 PM
                0 responses
                61 views
                1 like
                Last Post CaptainJack  
                Started by CarlTrading, 03-30-2026, 11:51 AM
                0 responses
                62 views
                0 likes
                Last Post CarlTrading  
                Started by CarlTrading, 03-30-2026, 11:48 AM
                0 responses
                53 views
                0 likes
                Last Post CarlTrading  
                Working...
                X