FOR ME, IT'S A MILLION DOLLAR QUESTION..... PLEASE HELP!!!
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); } //+------------------------------------------------------------------+
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