
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Did I get it right that the values returned by ACCOUNT_TRADE_ALLOWED are generated on the server side?
I mean no action from trader's side (in terminal) can change this value...
PS
But ACCOUNT_TRADE_EXPERT's reluctance to change is really strange...
What does "Auto-Trading" button in terminal menu and "Allow auto-trading" checkbox do then?
PPS
In old releases all seemed to be correct and everything worked, but in 299 I don't understand what's going on...
Who dug in ACCOUNT_TRADE_ALLOWED and ACCOUNT_TRADE_EXPERT and why?
To developers - Either I'm already going crazy or "drubashki" appeared in the terminal... :)
And not in the latest release, but at least in 294 (who let them there?)... :(
A little experiment
Let's take the terminal release 294 and place on the chart an Expert Advisor that controls the return value of AccountInfoInteger(ACCOUNT_TRADE_ALLOWED).
At the same time, auto-trading is disabled in Expert Advisor parameters and in the terminal (the "auto-trading" button).
As a result, the Expert Advisor's log contains the following
Here we can see the log of actions performed by the Expert Advisor (during initialization) and checking of ACCOUNT_TRADE_ALLOWED value in the timer.
We are interested in all symbols highlighted in colour (before this the symbol list was loaded into a specialized class).
1. The first result returned by the timer is blue (it is expected to be false);
2. Red colour highlights the next result, which was returned by the timer, it suddenly turned out to be true(I'm very interested in what BARABACA allowed to trade);
3. The reaction of my class (event OnEventTimer) to the changes is green.
Here the class "understands" that auto-trading is allowed and happily informs about it (I don't share its optimism);
Moreover, the message is displayed twice (although it hadn't been seen before). The message must not appear twice, as OnEventTimer event contains a check which excludes this possibility.
4. Then timer constantly returns true, whatever happens to the terminal.
PS
The situation with AccountInfoInteger(ACCOUNT_TRADE_EXPERT) is even more confusing. The timer returns ture regardless of terminal and Expert Advisor settings.
Do we need it?
I am also interested in a similar question. What should I do if there are not enough funds in my account to open a position?
1. Stop the Expert Advisor from trading.
2. Prohibit opening of a position.
3. Remove the Expert Advisor from the chart.
Point 3 can be resolved using ExpertRemove. I have solved the 2nd item this way:
1. I understand that prohibition of trading is not set programmatically, but by using the "Auto-Trading" button and checkbox "Allow auto-trading" followed by checking ACCOUNT_TRADE_ALLOWED and ACCOUNT_TRADE_EXPERT.
You can also prohibit trading by adding the necessary parameter to your Expert Advisor and then controlling this parameter (for example, prohibit to trade on a real account).
The preliminary control is performed during initialization of an Expert Advisor, while in the working mode it is handled in OnTimer() or OnTick().
2. The control of the possibility to open (close) a position must be conducted considering the current state: the connection, the possibility of auto-trading, and other conditions (for example, controlling the possibility to perform a certain operation for this symbol).
For controlling all conditions, it is better to create one function with a bool-like result.
For example, like this one:
3. Expert Advisor should be removed from the chart only in extreme cases (when its work cannot be done or when it is no longer needed)
This situation is very extreme and rare. It should be used, for example, if some files necessary for the Expert Advisor are not found, or if there is an error the Expert Advisor cannot solve.
PS
Removing and placing EAs is also useful if several EAs trade on different pairs, but they are managed by one EA (he decides which pair to place an EA on and which to remove)...
Who dug into ACCOUNT_TRADE_ALLOWED and ACCOUNT_TRADE_EXPERT, and most importantly, why?
Developers - Either I'm already going crazy or there are "drubashki" in the terminal... :)
And not in the latest release, but at least in 294 (who let them in there?)... :(
A little experiment
Let's take the terminal release 294 and place on the chart an Expert Advisor that controls the return value of AccountInfoInteger(ACCOUNT_TRADE_ALLOWED).
At the same time, auto-trading is disabled in Expert Advisor parameters and in the terminal (the "auto-trading" button).
As a result, the Expert Advisor's log contains the following
Here we can see the log of actions performed by the Expert Advisor (during initialization) and checking of ACCOUNT_TRADE_ALLOWED value in the timer.
We are interested in all symbols highlighted in colour (before this the symbol list was loaded into a specialized class).
1. The first result returned by the timer is blue (it is expected to be false);
2. Red colour highlights the next result, which was returned by the timer, it suddenly turned out to be true(I'm very interested in what BARABACA allowed to trade);
3. The reaction of my class (event OnEventTimer) to the changes is green.
Here the class "understands" that auto-trading is allowed and happily informs about it (I don't share its optimism);
Moreover, the message is displayed twice (although it hadn't been seen before). The message must not appear twice, as OnEventTimer event contains a check which excludes this possibility.
4. Then timer constantly returns true, whatever happens to the terminal.
PS
The situation with AccountInfoInteger(ACCOUNT_TRADE_EXPERT) is even more confusing. The timer returns ture regardless of terminal and Expert Advisor settings.
Do we need it?
Something strange is going on here, ACCOUNT_TRADE_ALLOWED and ACCOUNT_TRADE_EXPERT are permissions to trade in the brokerage company.
Button "AutoTrade". - TerminalInfoInteger(TERMINAL_TRADE_ALLOWED).
There is MQL5InfoInteger(MQL5_TRADE_ALLOWED) - permission/prohibition for expert/script to trade
Something strange happens, ACCOUNT_TRADE_ALLOWED and ACCOUNT_TRADE_EXPERT are permission to trade in the DC.
Button "AutoTrade". - TerminalInfoInteger(TERMINAL_TRADE_ALLOWED).
There is also MQL5InfoInteger(MQL5_TRADE_ALLOWED) - permission/prohibition for expert/script to trade
I know about MQL5InfoInteger(MQL5_TRADE_ALLOWED), it works well and is normally monitored in Expert Advisor; MQL5_DLLS_ALLOWED is also normally processed.
Thus, as I understand it:
TERMINAL_DLLS_ALLOWED and TERMINAL_TRADE_ALLOWED are terminal level permissions;
MQL5_DLLS_ALLOWED and MQL5_TRADE_ALLOWED - permissions at expert level;
ACCOUNT_TRADE_ALLOWED and ACCOUNT_TRADE_EXPERT - permissions at server level.
Then we will assume that this is the server that changes false to true (although it's not clear why this message is shown twice).
Good afternoon I have this problem, I start scrolling the hourly chart and at a certain date it goes to the daily chart, also with 15 minutes they go to hourly or 4 hourly, deleted files where the history is stored according to the documentation but nothing has changed.
Good afternoon I have this problem, I start scrolling the hourly chart and at a certain date it goes to the daily chart, also with 15 minutes they go to hourly or 4 hourly, deleted files where the history is stored according to the documentation but nothing has changed.
I have found that there is an issue with HistoryDealsTotal() while using the optimization algorithms of the tester.
During a normal backtest everything's fine, but in an optimization session, during the initialization phase of the EA, HistoryDealsTotal() returns the number of deals from the previous run of the EA. Later on, during the trading phase, HistoryDealsTotal() starts at 0 again.
I ran into this issue through the following code snippet:
The way around this, is to initialize with 0 instead, but still I would be pleased with an official reply to this issue, because to me it looks like some internal variables are reset too late.
Thanks in advance!
Hello, answer my question:
Why can't i download mt5, i download the installation file, i start it halfway, it stops, skips to another access point, etc. At the end there is an error-
-read failed [12002]
this is the story constantly no matter how many times i reinstall the terminal or windows but now the third day it fails
please tell me why this construction always returns 0
and how do I know how many minutes it is now?