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 argusthome, 03-08-2026, 10:06 AM
      0 responses
      111 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      59 views
      0 likes
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      38 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Started by TheRealMorford, 03-05-2026, 06:15 PM
      0 responses
      41 views
      0 likes
      Last Post TheRealMorford  
      Started by Mindset, 02-28-2026, 06:16 AM
      0 responses
      78 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Working...
      X