[WARNING CLOSED!] Any newbie question, so as not to clutter up the forum. Professionals, don't go by. Can't go anywhere without you. - page 66
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
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)
}