//+------------------------------------------------------------------+ //| JMBUYERv2.mq4 | //| Copyright © 2008, PRMQuotes Software Corp. | //| Jedimedic77@gmail.com | //+------------------------------------------------------------------+ #property copyright "Copyright © 2008, PRMQuotes Software Corp." #include #include //+----------------------------------------------------------------------+ //| To modify Lotsize of script change value listed here, right now | //| its set to 1.0 change that value if you desire different lotsize | //| I have found that it is important to keep the decimal in place, | //| but really dont know why yet, but fractional lots work too (ex... | //| 0.1, 0.3, 1.12), you get the picture. | //| AGAIN DONT FORGET TO SAVE AND COMPILE AFTER MAKING ANY MODIFICATIONS | //+----------------------------------------------------------------------+ double Lots = 0.1; // change this number to change the lotsize double stoploss = 15; // change this number to change the stoploss double takeprofit1 = 15; // change this number to change the takeprofit double takeprofit2 = 60; // change this number to change the takeprofit double takeprofit3 = 60; // change this number to change the takeprofit //+---Don't forget to save and compile after changing the Lotsize--------+ //+------------------------------------------------------------------+ //| Each of the following lines produces an individual order | //| 3 lines produces 3 orders, to increase or decrease the number | //| of individual orders either add, or take away identical lines | //| within the parenthesis. Again dont forget to save and compile | //| time you modify the code. | //+------------------------------------------------------------------+ int start() { while(true) { int ticket1=OrderSend(Symbol(),OP_BUY,Lots,Ask,3,Bid-stoploss*Point,Bid+takeprofit1*Point,NULL,0,0,Blue); //Order send if (ticket1>0) //OK break; int Error1=GetLastError(); // Errors check switch(Error1) // switch { case 135: //Error 135 RefreshRates(); // Refresh rates continue; // Next itaration case 136: // Error 136 while(RefreshRates()==false) // New tick waiting Sleep(1); // Cycle waiting continue; // Next itaration case 146: //Error 146 Sleep(500); // Simple waiting RefreshRates(); // Refresh rates continue; // Next itaration } switch(Error1) { case 2 : Alert("Error. Will try later"); break; case 5 : Alert("Terminal old version. Will try later"); break; case 64: Alert("Account block. Will try later"); break; case 133:Alert("No trade. Will try later"); break; default: Sleep(500); // Simple waiting RefreshRates(); // Refresh rates continue; } break; } while(true) { int ticket2=OrderSend(Symbol(),OP_BUY,Lots,Ask,3,Bid-stoploss*Point,Bid+takeprofit2*Point,NULL,0,0,Blue); //Order send if (ticket2>0) //OK break; int Error2=GetLastError(); // Errors check switch(Error2) // switch { case 135: //Error 135 RefreshRates(); // Refresh rates continue; // Next itaration case 136: // Error 136 while(RefreshRates()==false) // New tick waiting Sleep(1); // Cycle waiting continue; // Next itaration case 146: //Error 146 Sleep(500); // Simple waiting RefreshRates(); // Refresh rates continue; // Next itaration } switch(Error2) { case 2 : Alert("Error. Will try later"); break; case 5 : Alert("Terminal old version. Will try later"); break; case 64: Alert("Account block. Will try later"); break; case 133:Alert("No trade. Will try later"); break; default: Sleep(500); // Simple waiting RefreshRates(); // Refresh rates continue; } break; } while(true) { int ticket3=OrderSend(Symbol(),OP_BUY,Lots,Ask,3,Bid-stoploss*Point,Bid+takeprofit3*Point,NULL,0,0,Blue); //Order send if (ticket3>0) //OK break; int Error3=GetLastError(); // Errors check switch(Error3) // switch { case 135: //Error 135 RefreshRates(); // Refresh rates continue; // Next itaration case 136: // Error 136 while(RefreshRates()==false) // New tick waiting Sleep(1); // Cycle waiting continue; // Next itaration case 146: //Error 146 Sleep(500); // Simple waiting RefreshRates(); // Refresh rates continue; // Next itaration } switch(Error3) { case 2 : Alert("Error. Will try later"); break; case 5 : Alert("Terminal old version. Will try later"); break; case 64: Alert("Account block. Will try later"); break; case 133:Alert("No trade. Will try later"); break; default: Sleep(500); // Simple waiting RefreshRates(); // Refresh rates continue; } break; } return(0); } //+------------------------------------------------------------------+ //+------------------------------------------------------------------+ ------------------------------------------------------------------------------------------------------- //+------------------------------------------------------------------+ //| DBuy.mq4 | //| Copyright © 2010, Gorbushin Grigory (Dzhini) | //| grin2000@rbcmail.ru | //+------------------------------------------------------------------+ #property copyright "Copyright © 2010, Gorbushin Grigory (Dzhini)" #property link "grin2000@rbcmail.ru" #include #include //+----------------------------------------------------------------------+ //| To modify Lotsize of script change value listed here, right now | //| its set to 1.0 change that value if you desire different lotsize | //| I have found that it is important to keep the decimal in place, | //| but really dont know why yet, but fractional lots work too (ex... | //| 0.1, 0.3, 1.12), you get the picture. | //| AGAIN DONT FORGET TO SAVE AND COMPILE AFTER MAKING ANY MODIFICATIONS | //+----------------------------------------------------------------------+ double Lots = 0.1; // change this number to change the lotsize double stoploss = 15; // change this number to change the stoploss double takeprofit1 = 15; // change this number to change the takeprofit double takeprofit2 = 60; // change this number to change the takeprofit double takeprofit3 = 60; // change this number to change the takeprofit double takeprofit4 = 60; double takeprofit5 = 60; int orders = 3; double takeprofit; // ---------------------------------------------------------------------- //----------------------------------------------------------------------- int start () { //---------------------------------------------------- for (int i=1; i<=orders; i++) //cycle { //------------------------------------------ TP level switch (i) { case 1: takeprofit = takeprofit1; continue; case 2: takeprofit = takeprofit2; continue; case 3: takeprofit = takeprofit3; continue; case 4: takeprofit = takeprofit4; continue; case 5: takeprofit = takeprofit5; continue; } //------------------------------------------ Lot // RefreshRates(); while(true) { int ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,3,Bid-stoploss*Point,Bid+takeprofit*Point,NULL,0,0,Blue); //Order send if (ticket>0) //OK break; int Error =GetLastError(); // Errors check switch(Error) // switch { case 135: //Error 135 RefreshRates(); // Refresh rates continue; // Next itaration case 136: // Error 136 while(RefreshRates()==false) // New tick waiting Sleep(1); // Cycle waiting continue; // Next itaration case 146: //Error 146 Sleep(500); // Simple waiting RefreshRates(); // Refresh rates continue; // Next itaration } switch(Error) { case 2 : Alert("Error. Will try later"); break; case 5 : Alert("Terminal old version. Will try later"); break; case 64: Alert("Account block. Will try later"); break; case 133:Alert("No trade. Will try later"); break; default: Sleep(500); // Simple waiting RefreshRates(); // Refresh rates continue; // Next itaration } break; } //----------------------------------------------------------- } return(0); } //+------------------------------------------------------------------+