Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Specify Order Name With OnExecutionUpdate?

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

    Specify Order Name With OnExecutionUpdate?

    Hello! I'm at the stage in my strategy's development that I'd like to get into some advanced order handling.

    If using the OnExecutionUpdate() function, can an Order Name be specified and if so, how?

    I've given different entries different Names and would like entry A to have a different set of exit conditions than entry B.

    Is there a better function to use in this scenario?


    #2
    Hello trilliantrader,

    Yes the name can be specified, that is known as the orders signal name. When you call an entry method you can supply a orders name.

    EnterLong(string signalName)

    ​In OnExecutionUpdate you would see the orders name as the execution name.

    Comment


      #3
      Ok, so if I have in a pervious statement

      EnterLong (string signalA)

      Can I specify this order "signalA" in the next if statement?

      if (execution.Order.OrderState == OrderState.Filled && sumFilled == execution.Order.Filled)

      ​If so, how?

      Comment


        #4
        Hello trilliantrader,

        Yes you would check for execution.Name == "YourSignalName"

        Comment


          #5
          Hi Jesse, I have entered the order with EnterShortStopMarket under protected override void OnBarUpdate(). For profit-taking & stop-loss orders, I entered via protected override void OnExecutionUpdate (as my main data series is 5-min and I would like to exit via a 1-min timeframe). I tried to check whether the trade exited via the profit-taking or stop-loss orders in the Output window, yet it did not work. Which part does it go wrong?


          protected override void OnExecutionUpdate(Execution execution, string executionId, double price, int quantity, MarketPosition marketPosition, string orderId, DateTime time)
          {
          ExitLongLimit(1, true, quantity, profit-taking price, "LongProfitTaking", "LongEntry");
          if (execution.Order.Name == "LongProfitTaking")
          {
          Print("Proft-taking");
          }

          ExitLongStopMarket(1, true, quantity, stop-loss price, "LongStopLoss", "LongEntry");
          if (execution.Order.Name == "LongStopLoss")
          {
          Print("Stop-loss");
          }

          Comment


            #6
            Hello morong0414,

            Have you tried printing the execution to check what the name is listed as?

            Code:
            protected override void OnExecutionUpdate(Execution execution, string executionId, double price, int quantity, MarketPosition marketPosition, string orderId, DateTime time)
            {​
            
                Print(execution.Order.Name );

            Additionally you should not have ExitLongLimit inside of OnExecutionUpdate without a condition like you have shown, that would be called for every execution including their own so it would resubmit the exit again when it fills which may cause an inflight execution.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by NullPointStrategies, Yesterday, 05:17 AM
            0 responses
            71 views
            0 likes
            Last Post NullPointStrategies  
            Started by argusthome, 03-08-2026, 10:06 AM
            0 responses
            143 views
            0 likes
            Last Post argusthome  
            Started by NabilKhattabi, 03-06-2026, 11:18 AM
            0 responses
            76 views
            0 likes
            Last Post NabilKhattabi  
            Started by Deep42, 03-06-2026, 12:28 AM
            0 responses
            47 views
            0 likes
            Last Post Deep42
            by Deep42
             
            Started by TheRealMorford, 03-05-2026, 06:15 PM
            0 responses
            51 views
            0 likes
            Last Post TheRealMorford  
            Working...
            X