Alert on Negative Close

 

I'd like to setup an alert when an order is closed resulting in a loss.


I'm working with an EA that I have setup with a stop-loss; however this is a trend-follower and I'd like to give it some breathing room after a reversal.

Since I can't reprogram the EA, I'll have to the second-best thing.


Once a custom alert is created I know that I have a lot more options, but I need to be able to create the alert in the first place.


Is this possible to do, monitor trades outside of an EA?

 
EA, Indicator or Script all have access to current trade information and trade history, so yes, it is possible.
 
phy:
EA, Indicator or Script all have access to current trade information and trade history, so yes, it is possible.

Ok, great news.


Now, can someone direct me to an example of how I can accomplish this.

 
mixtermind:

Ok, great news.


Now, can someone direct me to an example of how I can accomplish this.


My solution:

if(!AccountBalance()==lastaccountbalance)
   {
   int hstTotal=OrdersHistoryTotal()-1;
   if(OrderSelect(hstTotal,SELECT_BY_POS,MODE_HISTORY)==true)
       {
       if (OrderProfit()<0) Alert("Losing business!");  
       }
   }
lastaccountbalance=AccountBalance();
 
ggekko:

My solution:

Thanks ggekko. This is a great start.