Abhishek Pandey
Abhishek Pandey

Reputation: 1

Want to create an alert/Expert Advisor or Indicator in MT5 if any pending order get executed

Can someone help me to create an indicator in which if client make Limit orders like Buy Limit, Sell Limit, Buy Stop or Sell Stop and if orders get executed then i should have an alert with some sound or without sound, if any pop up will come that is also fine for me.

I am looking for it from last so many days.

For the reference you can check MQL PDF.

"https://www.mql5.com/files/pdf/mql5.pdf".

Regards, Abhishek

Upvotes: 0

Views: 737

Answers (1)

Wilfredo Pomier
Wilfredo Pomier

Reputation: 1121

AFAIK only EAs can do that.

You can start with the following code:

void OnTradeTransaction (const MqlTradeTransaction &trans, const MqlTradeRequest &request, const MqlTradeResult &result ) {
   switch(trans.type) {
   case TRADE_TRANSACTION_DEAL_ADD:
      if(HistoryDealSelect(trans.deal)) {
         entry = (ENUM_DEAL_ENTRY)HistoryDealGetInteger(trans.deal, DEAL_ENTRY);
         if(entry == DEAL_ENTRY_IN)
            onDeal(trans); // An order was opened
      }
      break;
   }
}

void onDeal(const MqlTradeTransaction &trans) {
   // Your code goes here, e.x. Sound
   PlaySound("news.wav")
}

Upvotes: 0

Related Questions