Open more than 1 symbols New comment [Deleted] 2009.04.06 19:04 Hi there I would like to open 16 symbol orders at the same time. I code like these, but it does not work Please help me to figure out; thanks //Length for oType------------------------------- int oType[16] = {1,0,0,0,1,0,0,0,1,0,1,0,0,0,1,1}; //sell = 0, buy = 1 //Length for SLpips and TPpips------------------------------------- int SLpips[16] = {55,35,52,53, 40,41,57,47, 49,41,54,32, 47,37,46,29}; int TPpips[16] = {13,08,12,14, 09,10,13,11, 11,10,13,07, 11,08,11,07}; double dVolume = 0.01; string sym[16] = {"USDCHF","USDJPY", "USDCAD", "NZDUSD", "EURCHF", "EURJPY", "GBPCHF", "EURAUD", "EURUSD", "AUDUSD", "CHFJPY", "EURGBP", "GBPJPY", "EURCAD", "AUDJPY"}; double SL[16]; double TP[16]; int i = 1; SL[1] = SLpips[1]/10000; TP[1] = TPpips[1]/10000; OrderSend(sym[1], OP_BUY, dVolume, Ask, 2, Ask - SL[1], Ask + TP[1]); for(i=1; i<16; i++) { if(i==2 || i==7 ||i==12 ||i==14 ||i==16){SL[i] = SLpips[i]/100; TP[i] = TPpips[i]/100;} else{SL[i] = SLpips[i]/10000; TP[i] = TPpips[i]/10000; } if (oType[i]==1) { OrderSend(sym[i], OP_BUY, dVolume, Ask, 2, Ask - SL[i], Ask + TP[i]);} else{ OrderSend(sym[i],OP_SELL, dVolume, Bid, 2, Bid + SL[i], Bid - TP[i]);} } return(0); Coding help MQL4 Learning Strategic foresight systems New comment
Hi there
I would like to open 16 symbol orders at the same time. I code like these, but it does not work
Please help me to figure out; thanks
//Length for oType-------------------------------
int oType[16] = {1,0,0,0,1,0,0,0,1,0,1,0,0,0,1,1}; //sell = 0, buy = 1
//Length for SLpips and TPpips-------------------------------------
int SLpips[16] = {55,35,52,53, 40,41,57,47, 49,41,54,32, 47,37,46,29};
int TPpips[16] = {13,08,12,14, 09,10,13,11, 11,10,13,07, 11,08,11,07};
double dVolume = 0.01;
string sym[16] = {"USDCHF","USDJPY", "USDCAD", "NZDUSD", "EURCHF", "EURJPY", "GBPCHF", "EURAUD", "EURUSD", "AUDUSD", "CHFJPY", "EURGBP", "GBPJPY", "EURCAD", "AUDJPY"};
double SL[16];
double TP[16];
int i = 1;
SL[1] = SLpips[1]/10000; TP[1] = TPpips[1]/10000;
OrderSend(sym[1], OP_BUY, dVolume, Ask, 2, Ask - SL[1], Ask + TP[1]);
for(i=1; i<16; i++)
{
if(i==2 || i==7 ||i==12 ||i==14 ||i==16){SL[i] = SLpips[i]/100; TP[i] = TPpips[i]/100;}
else{SL[i] = SLpips[i]/10000; TP[i] = TPpips[i]/10000; }
if (oType[i]==1) { OrderSend(sym[i], OP_BUY, dVolume, Ask, 2, Ask - SL[i], Ask + TP[i]);}
else{ OrderSend(sym[i],OP_SELL, dVolume, Bid, 2, Bid + SL[i], Bid - TP[i]);}
}
return(0);