- Need help indentifying indicator
- Need EA to close trade based on CLOSING price of the candle instead of current price
- E-mail alerts: programmed into code or a platform option?
I am new to using MT5, after using Ninjatrader, and I can't believe that a trade's SP or TP can be reached and the trade ends and there is no alert noise to inform me. To me this is a basic requirement for a platform and I can't believe it is not on MT5. I can't find a solution. Do MT5 traders simply work in silence? Or am I missing something? I believe I saw an advert for a file you can use for Mt4 but I can find nothing for MT5. It is such a simple thing - am I the only person who wants such an alert ?
You can use the alerts tab on the Toolbox. Add your SL and TP and tell it what sort of alerts that you want.
Or, find an ea or script on codebase. I think that this is how the majority of us do it.You can use the alerts tab on the Toolbox. Add your SL and TP and tell it what sort of alerts that you want.
Or, find an ea or script on codebase. I think that this is how the majority of us do it.I am new to using MT5, after using Ninjatrader, and I can't believe that a trade's SP or TP can be reached and the trade ends and there is no alert noise to inform me. To me this is a basic requirement for a platform and I can't believe it is not on MT5. I can't find a solution. Do MT5 traders simply work in silence? Or am I missing something? I believe I saw an advert for a file you can use for Mt4 but I can find nothing for MT5. It is such a simple thing - am I the only person who wants such an alert ?
Try this in the OnTick function
// Check if any positions are open int total_positions = PositionsTotal(); if (total_positions > 0) { // Loop through all positions for (int i = 0; i < total_positions; i++) { // Get the ticket number of the position ulong ticket = PositionGetTicket(i); // Check if the position is active if (PositionSelect(ticket)) { // Get the stop loss and take profit levels of the position double stop_loss = PositionGetDouble(POSITION_SL); double take_profit = PositionGetDouble(POSITION_TP); // Get the current market price double current_price = SymbolInfoDouble(_Symbol, SYMBOL_BID); // Check if the stop loss or take profit level is reached if (current_price <= stop_loss || current_price >= take_profit) { // Send a notification string message; if (current_price <= stop_loss) message = "Stop Loss Reached for Position " + IntegerToString(ticket); else message = "Take Profit Reached for Position " + IntegerToString(ticket); SendNotification(message); } } } } }
Positions refer to open trades running. So if a trade has TPed or SLed it won't show up in Positions list for you to iterate.
I think best solution is handling OnTradeTransaction event.
I am new to using MT5, after using Ninjatrader, and I can't believe that a trade's SP or TP can be reached and the trade ends and there is no alert noise to inform me. To me this is a basic requirement for a platform and I can't believe it is not on MT5. I can't find a solution. Do MT5 traders simply work in silence? Or am I missing something? I believe I saw an advert for a file you can use for Mt4 but I can find nothing for MT5. It is such a simple thing - am I the only person who wants such an alert ?
It plays a sound file.
| bool PlaySound( |
Parameters
filename
[in] Path to a sound file. If filename=NULL, the playback is stopped.
Return Value
true – if the file is found, otherwise - false.
Note
The file must be located in terminal_directory\Sounds or its sub-directory. Only WAV files are played.
Call of PlaySound() with NULL parameter stops playback.
PlaySound() function does not work in the Strategy Tester.
https://www.mql5.com/en/docs/common/playsound
- www.mql5.com
Why reinvent the wheel?
MQL5 Cookbook: Sound Notifications for MetaTrader 5 Trade Events
Anatoli Kazharski, 2013.10.23 11:38
In this article, we will consider such issues as including sound files in the file of the Expert Advisor, and thus adding sound notifications to trade events. The fact that the files will be included means that the sound files will be located inside the Expert Advisor. So when giving the compiled version of the Expert Advisor (*.ex5) to another user, you will not have to also provide the sound files and explain where they need to be saved.- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use