send it at the moment it is closed, when it is closed.
Marco vd Heijden:
send it at the moment it is closed, when it is closed.
How?
send it at the moment it is closed, when it is closed.

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hello,
I've been trying to fix my indicator which should send me a push notification if my order has hit SL or TP and for some reason every time an order closes I do get a push notification but for all my trades in my history. How do I make it so I only get it for the one that just closed and not the ones that have closed at a previous date? Thanks
void AlertOrder()
{
string txt;
double OCP;
int i=OrdersHistoryTotal()-1;
if(OrderSelect(i,SELECT_BY_POS,MODE_HISTORY)==true)
{
OCP=OrderClosePrice();
if (OCP==OrderStopLoss()) txt="SL";
if (OCP==OrderTakeProfit()) txt="TP";
}
SendNotification(Symbol() + " hit "+txt+"");
}