Single post

Passing of Request from MT5 Terminal to MT5 Server

To do a trade operation you may want to send out an order to the trade system. A request is constantly sent out to trade server with sending an order from the customer terminal. The framework of a request need to be filled properly, no matter how you trade – by hand or utilizing an MQL5 program.

To execute a trade operation by hand, you must open the dialog window of filling a trade request by pushing the F9 trick. When trading instantly with MQL5, requests are sent out making use of the OrderSend () feature. Because a great deal of inaccurate requests could give an unwanted overloading of the trade server, each request needs to be examined prior to it is sent out utilizing the OrderCheck () feature. The outcome of inspecting a request is put to a changeable explained by the MqlTradeCheckresult framework.
Vital: Each request is inspected for accuracy in the customer terminal prior to it is sent out to the trade server. Intentionally inaccurate requests (to get a million whole lots or get by an adverse cost) are not passed outside the customer terminal. It is done to shield the trade servers from a mass of inaccurate request given by an error in a MQL5 program.

As soon as a request shows up to the trade server, it passes the primary check:.

whether you have sufficient possessions to execute the trade operation;.
whether the pointed out rate are appropriate: open rates, Quit Loss, Take Revenue, etc.;.
whether the pointed out rate exists in the rate flow for immediate execution;.
whether the Stop Loss and Take Revenue levels are missing in the Market Execution mode;.
whether the volume is right: minimum and max volume, action, optimal volume of the position (SYMBOL_VOLUME_MIN, SYMBOL_VOLUME_MAX, SYMBOL_VOLUME_STEP and SYMBOL_VOLUME_LIMIT);.
state of the sign: quote or trade session, possibility of trading by the sign, a particular mode of trading (e.g. just closing of positions), etc.;.
state of the trade account: various constraints for certain sorts of accounts;.
various other checks, relying on asked for trade operation.

An inaccurate request that does not pass the primary examine the server is declined. The customer terminal is constantly notified about the outcome of checking of a request by sending out a feedback. The feedback of the trade server could be drawned from a changeable of the MqlTradeResult kind, which is passed as the 2nd specification in the OrderSend () feature when sending out a request.

theme by teslathemes