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, 05-11-2026, 05:56 AM
      0 responses
      52 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 05-10-2026, 08:12 PM
      0 responses
      29 views
      0 likes
      Last Post CarlTrading  
      Started by Hwop38, 05-04-2026, 07:02 PM
      0 responses
      192 views
      0 likes
      Last Post Hwop38
      by Hwop38
       
      Started by CaptainJack, 04-24-2026, 11:07 PM
      0 responses
      354 views
      0 likes
      Last Post CaptainJack  
      Started by Mindset, 04-21-2026, 06:46 AM
      0 responses
      273 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Working...
      X