Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 1709

 
Andrey I.R.O.V #:
Please tell me if anyone knows how to connect MT4 or MT5 with PHP ? The trading robot should work on the server, request quotes from a broker and create/cancel/monitor orders. The broker only has MT4 and MT5 terminals, it doesn't have API :) Or am I stupid and it doesn't happen at all?

can be done. Anything can be done.

But it is guaranteed to slow down in php, it is not designed for such purposes.

And then the MQL syntax is almost the same, knowing php you can master mql in a week.

 
MakarFX #:
you don't need all code, only OrderSend

so it's pretty simple

ticket = OrderSend(Symbol(),OP_BUY, Lot*3, Ask, Slippage, SLbuy, 0, "open buy order", Magic, 0, Blue);

or

ticket = OrderSend(Symbol(),OP_SELL, Lot*3, Bid, Slippage, SLsell, 0, "open Sell order", Magic, 0, Red);


The situation is that I still connect those or those operations through bool. And there are a lot of them. I told you, it's easier for me to remove unnecessary.

 
Alexey Viktorov #:

It is easier to insert a Print with the conditions for opening an order yourself. Most likely, the order opening conditions are saved after the first order is opened. For example, the number of open orders == 0 and after the first order was opened, this value has not changed...

The meaning of your guess is understood, probably this is how it happens but practically how to find this "saving". The code is huge.

 
Порт-моне тв #:

so it's pretty simple

ticket = OrderSend(Symbol(),OP_BUY, Lot*3, Ask, Slippage, SLbuy, 0, "open buy order", Magic, 0, Blue);

or

ticket = OrderSend(Symbol(),OP_SELL, Lot*3, Bid, Slippage, SLsell, 0, "open Sell order", Magic, 0, Red);


The situation is that I still connect those or those operations through bool. And I have a lot of them. I'm telling you, it's easier for me to remove unnecessary.

Just a note: lots must be aligned. Even if it's just multiplication by an integer.

 
Maxim Kuznetsov #:

just a note: Lots have to be aligned. Even if just multiplying by an integer

what is "alignment"? Thanks of course, but that's not what's bugging me.

 
Порт-моне тв #:

I get the gist of your conjecture, that's probably how it works, but practically how to find this "save". The code is huge.

Here are the Prints to help you find them...

 
Alexey Viktorov #:

The Prints will help you find them...

Well, I can see from the history in the tester where, when and with what parameters. What gives?

 
Maxim Kuznetsov #:

can be done. Anything can be done.

But it is guaranteed to slow down in php, it is not designed for such purposes.

And then the MQL syntax is almost the same, knowing php you can master mql in a week.

Thanks for the tips, it's already a bit clearer in my head how and what to do. I can do it in MQL as well, as long as it is a VPS
 

Guys, no need to be redundant. Just like removing two orders with the same price, lot and opening time and that's it! That will be enough! In the tester out of 100000 orders happened really 4 times. That is, it happens extremely rarely, but because of one such doublet, the strategy moved away.

 
Порт-моне тв opening time and that's it! That will be enough! In the tester out of 100000 orders happened really 4 times. That is, it happens very rarely, but one such double happened, and the strategy moved away because of it.

Do this and there will be no doubling.

if(OrderSend(Symbol(),OP_BUY, Lot*3, Ask, Slippage, SLbuy, 0, "открыт ордер на покупку", Magic, 0, Blue))
   {Print("OpenBuy");}
if(OrderSend(Symbol(),OP_SELL, Lot*3, Bid, Slippage, SLsell, 0, "открыт ордер на продажу", Magic, 0, Red))
   {Print("OpenSell");}