I guess you just need 3 orders to open for different instruments? Why not make a flag variable for example
In global variables create
int flag=0; string Symb;
///////////////
then
int start() { if (условие открытия) {flag=1;}
if (flag==1) { Symb="EURUSD"; OrderSend(Symb,...)///Открываем, переносим флаг во 2 состояние для открытия след ордера и flag=2; ///выходим тк больше мы ни чего не можем сделать return(0); }
if (flag==2) { Symb="AUDUSD"; OrderSend(Symb,...) flag=3; return(0); }
if (flag==3) { Symb="USDJPY"; OrderSend(Symb,...) flag=0;//Возвращаем флаг в начальное состояние.. return(0); } return(0);}
Also it would be good to add check of the opening and only after the check is successful move the flag.
Esteemed experts, who has an indicator that would show on each time frame levels of max-min levels for 25 and 50 bars and if the price rebounded from this level in any time frame in this place remained a line and stayed until the price breaks it?
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
In fact, in such cases I usually try to use GetLastError() more widely. Of course, I'm not a pro.
I understand that GetLastError() is supposed to say why something is not done, for example if a thread is busy, but I have nothing going on at all!
I guess you just need 3 orders to open for different instruments? Why not make a flag variable for example
In global variables create
int flag=0;
string Symb;
///////////////
then
int start()
{
if (условие открытия)
{flag=1;}
if (flag==1)
{
Symb="EURUSD";
OrderSend(Symb,...)///Открываем, переносим флаг во 2 состояние для открытия след ордера и
flag=2; ///выходим тк больше мы ни чего не можем сделать
return(0);
}
if (flag==2)
{
Symb="AUDUSD";
OrderSend(Symb,...)
flag=3;
return(0);
}
if (flag==3)
{
Symb="USDJPY";
OrderSend(Symb,...)
flag=0;//Возвращаем флаг в начальное состояние..
return(0);
}
return(0);}
Also it would be good to add check of the opening and only after the check is successful move the flag.
Thank you very much! I'll give it a try!
}
else Print ("Error opening long position:",GetLastError());
returns an error if OrderSelect() fails.
if(OrderSend(Symbol(), OP_SELLSTOP, getLots, Bid, 0, 0, 0, WindowExpertName(),Magic, 0, Red) < 0)
Print("Error Open Sellstop = ",GetLastError());
Returns an error if OrderSend() fails.there is a version that it is OrderSend() that does not work
any idea why it works on the tester?
any idea why it works on the tester?
No. But what I am saying is that by using the Print function more extensively (even if without the subsequent GetLastError),
you can see much better how the EA is trading.
for example like this:
if(MA1>MA2 && StochPrev<StohCur && StochPrev<SignPrev )
{
print("Condition for a buy order is met");
ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,3,Ask-StopLoss*Point,Ask+TakeProfit*Point,",16895,0,DeepSkyBlue);if(ticket>0)
}