Questions from a "dummy" - page 217

 
G001:
Right. That was my request, how to know programmatically when the EA stops working.
:))) yeah.

and call it "thank you, everyone, problem solved,"

You created it for yourself, not solved it ;)

 
G001: I was also thinking of using the asynchronous option, but I don't know if the broker won't count the trades.
What do you mean? There is a possibility that "the broker won't count the trades" because of the use ofOrderSendAsync()?
 
G001:

Don't use perpetual loops to check, that's probably the problem.
 
sergeev:
:))) yeah.

and call it "thank you, everyone, problem solved,"

You created it for yourself, not solved it ;)

Well, I didn't get any other advice. :)
So far it's the only workable option.
I've seen a lot of "miracles" in 5 years, and I don't think there are any solutions for all the "miracles" I've seen in the real world.
 

It is sad I am trying to make an EA with two functions (setting positions and reopening a position after it has closed at TP or SL but it needs to open together with the opposite position)

i can't even get such a simple EA to work, i've tried on forums too ((

 
G001:
Well, I didn't get any other advice. :)

you did, but you're ignoring it. ;)

you don't put prints and comments in cycles, you don't give a magazine.

You need to communicate here, not blame it on the terminal.

Клуб Телепатов - MQL4 форум
  • www.mql5.com
Клуб Телепатов - MQL4 форум
 
tol64: Don't use perpetual loops to check, this is probably the problem.

I noticed this part of the code:

      request.action = TRADE_ACTION_PENDING;
      request.magic = Magic;
      request.symbol = Symbol();
      request.volume = Volume();
      request.price=NormalizeDouble(Ask+OrderDrive*_Point,_Digits);
      request.sl = NormalizeDouble(request.price - StopLoss*_Point,_Digits);
      request.tp = NormalizeDouble(request.price + TakeProfit*_Point,_Digits);
      request.type=ORDER_TYPE_BUY_STOP;
      request.type_filling=ORDER_FILLING_RETURN;
      request.comment=Coments;
      int ResBull = -1;
      while(ResBull < 1)
      {
        if(OrderCheck(request,check))
          {
          ResBull = OrderSend(request,result);
          }
        if((MQL5InfoInteger(MQL5_TESTING)||MQL5InfoInteger(MQL5_OPTIMIZATION)))break;
      }
      Print("BuyStop Order Set ");
      if(UseSound == true){PlaySound(OrderSound);}
      Print(ResultRetcodeDescription(result.retcode));

What happens (question to the author) if OrderCheck(request,check) function returns false at some stage? For example, because of specifying incorrect volume for request.volume.

 
Yedelkin:

I noticed this part of the code:

What happens (question to the author) if OrderCheck(request,check) function returns false at some stage? For example, because request.volume is wrong.

And you may have noticed it correctly. Thank you.
Can you please tell me how to check and get rid of perpetual loop.
 
G001:
Well, I didn't get any other advice. :)
So far, this is the only workable option.
I've seen a lot of "miracles" in 5 years, and I don't think there are any solutions for all the "miracles" from the real world that work for us.
What if we try the CTrade class for sending orders as described in this article?
 
G001: Please advise how to check and get rid of the infinite loop.

There could be many options. Limit the number of iterations, abandon loop checking altogether, analyse the response code, etc. By the way, an infinite loop will also occur if the server rejects the trade request for some reason. I.e. the check logic must be changed completely.

I myself use no more than two checks of return codes and if the order cannot be placed, I wait for the arrival of a new tick.

Документация по MQL5: Стандартные константы, перечисления и структуры / Структуры данных / Структура торгового запроса
Документация по MQL5: Стандартные константы, перечисления и структуры / Структуры данных / Структура торгового запроса
  • www.mql5.com
Стандартные константы, перечисления и структуры / Структуры данных / Структура торгового запроса - Документация по MQL5
Reason: