Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to Send Email/Text for Stop Loss & Profit Target Trades

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

    How to Send Email/Text for Stop Loss & Profit Target Trades

    Hi,

    I use the SendMail() command to provide Emails and Texts for my Trade signals. But I'm uncertain how to do this with a Stop Loss and Profit Targets. Here is what I use for "regular" initiated trades.

    SendMail("My Email or Phone Number", "TRADE ALERT", "ENTER LONG " + TradeInstrument);



    From other posts, I have added the OnExecutionUpdate to print the signals.

    protected override void OnExecutionUpdate(Cbi.Execution execution, string executionId, double price, int quantity,Cbi.MarketPosition marketPosition, string orderId, DateTime time)
    {
    Print(execution.Order.ToString());
    Print(String.Format("executionId: {0}, price: {1}, quantity: {2}, marketPosition: {3}, orderId: {4}, time: {5}", executionId, price, quantity, marketPosition.ToString(), orderId, time));
    }


    Can I use this with the SendMail command? If so, how would I go about doing this for just the executed Stop Loss and Profit Target Exits?

    Thank you,
    Ray​

    #2
    Hello raysinred,

    Thank you for your post.

    You can identify an order within the OnExecutionUpdate method by using an if statement that checks the execution.Name property, and then use the SendMail method within that code block.
    Below is an example from the OnExecutionUpdate Help Guide page that checks execution.Name:

    Code:
    protected override void OnExecutionUpdate(Execution execution, string executionId, double price, int quantity, MarketPosition marketPosition, string orderId, DateTime time)
    
    {
    
    if (execution.Name == "Long limit entry 1")

    Please let me know if I may be of any further assistance.

    Comment


      #3
      Hi Eduardo,

      Ok, I think I got it. Thank you.

      Regards,
      Ray

      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