Attach this script to any chart on demo account and open and close an orders (including
pending orders).
//+------------------------------------------------------------------+ //| OrdersAlerts.mq4 | //| Copyright © 2007, MetaQuotes Software Corp. | //| https://www.metaquotes.net/ru/ | //+------------------------------------------------------------------+ #property copyright "Copyright © 2007, MetaQuotes Software Corp." #property link "https://www.metaquotes.net/ru/" //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ bool CheckSummChanged(int &ControlSumm) { bool res; int currSumm; //---- for(int i=0;i<OrdersTotal();i++) { if (OrderSelect(i,SELECT_BY_POS,MODE_TRADES)) currSumm+=(OrderType()+1)*OrderTicket(); } //---- if (currSumm!=ControlSumm) { ControlSumm=currSumm; res=true; } return(res); } //+------------------------------------------------------------------+ //| script program start function | //+------------------------------------------------------------------+ int start() { int prevcheckSumm; //---- while (!IsStopped()) { if (CheckSummChanged(prevcheckSumm)) Alert("Orders are changed!"); Sleep(1000); } //---- return(0); } //+------------------------------------------------------------------+

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
IS IT POSSIBLE TO PROGRAM MQL TO OPEN A NEW POSITION - AS SOON AS AN EXISTING POSITION CLOSES???
IN OTHER WORDS, WHEN AN OPEN POSITION CLOSES BY APPROACHING EITHER STOP-LOSS OR TAKE-PROFIT, A NEW POSITION SHOULD OPEN "AUTOMATICALLY".
CAN SOMEBODY PROVIDE ME WITH THE SOURCE CODE??
NASIR