What functions can be used to check if a trade thread is free for performing a trade operation? In MQL4, functions IsTradeAllowed() and IsTradeContextBusy() were intended for this purpose.
The CAccountInfo class of the standard library has the TradeAllowed() function. It is written in the help that it means:"Trading is allowed/forbidden for this account". I didn't find an error code in the trade server's return codes, which means the trade stream may be busy. Is this check now in the trading terminal itself? Please clarify.
tol64: What functions can be used to check if a trade thread is free for performing a trade operation? In MQL4, functions IsTradeAllowed() and IsTradeContextBusy() were intended for this purpose.
The CAccountInfo class of the standard library has the TradeAllowed() function. It is written in the help that it means:"Trading is allowed/forbidden for this account". I didn't find an error code in the trade server's return codes, which means the trade flow may be busy. Is this check now in the trading terminal itself? Please clarify.
In MT5, the trade thread is never busy because trade operations are asynchronous. Rejoice.
tol64: What functions can be used to check if a trade thread is free for performing a trade operation? In MQL4, functions IsTradeAllowed() and IsTradeContextBusy() were intended for this purpose.
The CAccountInfo class of the standard library has the TradeAllowed() function. It is written in the help that it means:"Trading is allowed/forbidden for this account ". I didn't find an error code in the trade server's return codes, which means the trade flow may be busy. Is this check now in the trading terminal itself? Please explain.
In MetaTrader5 there is no such a thing as a busy trade thread, while MT4 could process only one trader's order, in MT5 a lot of orders are processed in parallel. Return codes from the server for any order can be obtained in the OnTrade() function.
If no price is set (default is 0.0) or if the market price is set, CExpertTrade is prompted from CExpert to open a position on the market.
If the price is set better than the market (below the current price to buy and above the current price to sell), CExpertTrade will place a limit order (if the margin is respected).
If the price is below the market (above the current bid and below the current ask), CExpertTrade will place a stop order (if the margin is respected).
OpenLongParams doesn't work at all, it won't even return "1111111111", and LongCondition will return "2222222" and open an order, is it something wrong or is it set differently?
Lodar: OpenLongParams doesn't execute at all, it doesn't even write "1111111111", but LongCondition will write "222222222" and open an order, am I doing something wrong or is it set differently ?
In principle, things are much simpler. In 99 per cent of cases, the input level can be adjusted using an input parameter:
input double Inp_Signal_PriceLevel =0.0;
The value is set in "large" pips (i.e. 2/4 digits).
Value = 0 - market entry.
Value > 0 - entry by limit order.
Value < 0 - entry by stop order.
The parameter relates to the main signal (in which signals selected in the Wizard are collected for voting). The algorithm of price levels setting is already implemented in the CExpertSignal base class (the instance of which is the main signal).
But if you want to use an algorithm that differs from the implemented one... But that's for later, when it will be interesting.
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
Please explain why none of the EAs in MetaTrader 5 are tested in the strategy tester. I press start and nothing happens. Please explain.
Please explain why none of the EAs in MetaTrader 5 are tested in the strategy tester. I press start and nothing happens. Please explain.
Cannot retrieve data from predefined structures in created functions. For example:
Then when trying to retrieve values in a created function:
We get an error message:
How do I declare structures so that they are available in all parts of the program?
Cannot retrieve data from predefined structures in created functions. For example:
Then when trying to retrieve values in a created function:
We get an error message:
How do I declare structures so that they are available in all parts of the program?
The CAccountInfo class of the standard library has the TradeAllowed() function. It is written in the help that it means:"Trading is allowed/forbidden for this account". I didn't find an error code in the trade server's return codes, which means the trade stream may be busy. Is this check now in the trading terminal itself? Please clarify.
What functions can be used to check if a trade thread is free for performing a trade operation? In MQL4, functions IsTradeAllowed() and IsTradeContextBusy() were intended for this purpose.
The CAccountInfo class of the standard library has the TradeAllowed() function. It is written in the help that it means:"Trading is allowed/forbidden for this account". I didn't find an error code in the trade server's return codes, which means the trade flow may be busy. Is this check now in the trading terminal itself? Please clarify.
What functions can be used to check if a trade thread is free for performing a trade operation? In MQL4, functions IsTradeAllowed() and IsTradeContextBusy() were intended for this purpose.
The CAccountInfo class of the standard library has the TradeAllowed() function. It is written in the help that it means:"Trading is allowed/forbidden for this account ". I didn't find an error code in the trade server's return codes, which means the trade flow may be busy. Is this check now in the trading terminal itself? Please explain.
You just need to set the price.
If no price is set (default is 0.0) or if the market price is set, CExpertTrade is prompted from CExpert to open a position on the market.
If the price is set better than the market (below the current price to buy and above the current price to sell), CExpertTrade will place a limit order (if the margin is respected).
If the price is below the market (above the current bid and below the current ask), CExpertTrade will place a stop order (if the margin is respected).
and LongCondition will return "2222222" and open an order,
is it something wrong or is it set differently?
The specific type is set when the order is placed. OrderSend
OpenLongParams doesn't execute at all, it doesn't even write "1111111111",
but LongCondition will write "222222222" and open an order,
am I doing something wrong or is it set differently ?
In principle, things are much simpler. In 99 per cent of cases, the input level can be adjusted using an input parameter:
input double Inp_Signal_PriceLevel =0.0;
The value is set in "large" pips (i.e. 2/4 digits).
Value = 0 - market entry.
Value > 0 - entry by limit order.
Value < 0 - entry by stop order.
The parameter relates to the main signal (in which signals selected in the Wizard are collected for voting). The algorithm of price levels setting is already implemented in the CExpertSignal base class (the instance of which is the main signal).
But if you want to use an algorithm that differs from the implemented one... But that's for later, when it will be interesting.