[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

 
but actually, I usually try to use GetLastError() more extensively in such cases. Of course, I'm not a pro.
 
pepsi писал(а) >>
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!

 
Skydiver >> :

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!

 
if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES)) Print ("long position opened at price",OrderOpenPrice( ));
}

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 theory that it is OrderSend() that fails
 
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?
 
pepsi писал(а) >>
there is a version that it is OrderSend() that does not work

any idea why it works on the tester?

 
sten1981 >> :

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)

}

 
then the logbook demo will show everything more clearly. It is clearer where to look for the error. On your own...
Reason: