Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to determine when ProfitTarget is triggered?

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

    How to determine when ProfitTarget is triggered?

    Hello,

    How can I determine when my SetProfitTarget is triggered to execute further logic?

    Thank you!

    #2
    Hello Dragon989,

    Thank you for your note.

    You could see the following example which demonstrates how to determine whether your stop/target were hit.


    Please let us know if you need further assistance.
    Alan P.NinjaTrader Customer Service

    Comment


      #3
      Thank you! How do you differentiate between different ProfitTargets? I noticed the order name was "Profit Target". How would I now which one was long or short or which of my Profit Targets was triggered as they have different entry signals.

      Comment


        #4
        Hello Dragon989,

        In the case of multiple Profit Targets working you would want to filter by FromEntrySingal as well.

        For example,

        protected override void OnOrderUpdate(Order order, double limitPrice, double stopPrice, int quantity, int filled, double averageFillPrice, OrderState orderState, DateTime time, ErrorCode error, string nativeError)
        {
        if (order.Name == "Profit target" && order.FromEntrySignal =="LongA")
        {
        //Do Something.
        }

        if (order.Name == "Profit target" && order.FromEntrySignal =="LongB")
        {
        //Do Something.
        ​​​​​​​}
        }

        Please let us know if you need further assistance.
        Alan P.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by CarlTrading, 03-31-2026, 09:41 PM
        1 response
        47 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 04-01-2026, 02:41 AM
        0 responses
        23 views
        0 likes
        Last Post CarlTrading  
        Started by CaptainJack, 03-31-2026, 11:44 PM
        0 responses
        33 views
        1 like
        Last Post CaptainJack  
        Started by CarlTrading, 03-30-2026, 11:51 AM
        0 responses
        50 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 03-30-2026, 11:48 AM
        0 responses
        42 views
        0 likes
        Last Post CarlTrading  
        Working...
        X