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 Mindset, 04-21-2026, 06:46 AM
      0 responses
      87 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by M4ndoo, 04-20-2026, 05:21 PM
      0 responses
      128 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by M4ndoo, 04-19-2026, 05:54 PM
      0 responses
      65 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by cmoran13, 04-16-2026, 01:02 PM
      0 responses
      117 views
      0 likes
      Last Post cmoran13  
      Started by PaulMohn, 04-10-2026, 11:11 AM
      0 responses
      67 views
      0 likes
      Last Post PaulMohn  
      Working...
      X