Questions from Beginners MQL5 MT5 MetaTrader 5 - page 748
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
I have recently moved from mql4 to mql5. I am testing an Expert Advisor on the RTS Index and have a problem with opening several positions, although one of the conditions for opening a position is if (...OrdersTotal()==0). Why does not this condition work? What can I do to open only one position?
OrdersTotal
OrdersTotal Returns the number of active orders.
PositionsTotal
PositionsTotal Returns the number of open positions.
Note
There should be no confusion between activepending orders and positions, which are also displayed in the "Trade" tab of the "Toolbox" panel. An order is an order to executea trade, while a position is the result of one or moretrades.
With "netting" of positions (ACCOUNT_MARGIN_MODE_RETAIL_NETTING andACCOUNT_MARGIN_MODE_EXCHANGE) only oneposition can be opened for eachsymbol at any time and it is the result of one or moredeals. Positions and activepending orders, which are also displayed in the "Trade" tab of the "Toolbox" panel, should not be confused with each other.
In case of independent representation of positions (ACCOUNT_MARGIN_MODE_RETAIL_HEDGING) several positions can be opened for each symbol simultaneously.
That is, usingOrdersTotal, you check how many RETAILED ORDERS there are at the moment:
ORDER_TYPE_BUY_LIMIT
Pending Buy Limit order
ORDER_TYPE_SELL_LIMIT
Pending Sell Limit order
ORDER_TYPE_BUY_STOP
Pending Buy Stop order
ORDER_TYPE_SELL_STOP
Pending Sell Stop order
ORDER_TYPE_BUY_STOP_LIMIT
When the order price is reached, a Buy Limit pending order is placed at StopLimit price
ORDER_TYPE_SELL_STOP_LIMIT
When the order price is reached, a pending Sell Limit order is placed at StopLimit price
and you need to check how many open positions there are at that moment:
POSITION_TYPE_BUY
Buy
POSITION_TYPE_SELL
Sell
- PositionsTotal should be used for this.
Vladimir Karputov Thank you!
Good afternoon. After the latest MT5 update to build 1604 my indicators are no longer working correctly. I am using
So called "liquid" indicators. For example, I have several multi-period stochastics in one window. Well, now the short ones are drawn
As before, slightly longer ones draw only a few bars and the longest ones are not drawn at all.
I have the impression that they have suddenly started to lack history. Could you tell me what may be wrong?
That's no good, it's impossible to work. Will someone at least say something on the merits of the issue or not? Obviously the update is glitchy.
Where do people go for such questions?
Good afternoon. After the latest MT5 update to build 1604 my indicators are no longer working correctly. I am using
So called "liquid" indicators. For example, I have several multi-period stochastics in one window. Well, now the short ones are drawn
As before, slightly longer ones draw only a few bars and the longest ones are not drawn at all.
I have the impression that they have suddenly started to lack history. Could you tell me what may be wrong?
How do you access the history of another period? What checks do you perform to get access? What error codes do you get?
Hello! 2017.06.02_17:45 GMT+3. I have a question. The .mq5 program wrote its lot calculation, -- the result, -- the program in the strategy tester tries to open a trade with a prohibitively large lot. At risk percentage 1.09. The deposit size is larger than deposit (by default $10,000). I tried to use the standard OOP file from the folder Include>Expert>Money>MoneyFixedRisk.mqh . Result: The program tries to open a trade with zero lot. (0.00). I think -- it's a corporation programmers trick. Or am I missing something? Well, make your EA useless. Bend the lot on the side. Maybe, who knows what I should write, so that the Expert Advisor would open trades with the calculated lot, with the specified percentage of risk? I cannot do it myself, I am wasting my time. I hope the programmers of our corporation will not be offended. I am attaching the included file Lot.mqh . I hope that someone will answer. 18:00 GMT+3. Inserted at 18:11 GMT+3.
Run this EA:Money Fixed Risk- change both input parameters and see the prints in the "Experts" tab of the terminal.
I can't get any indicator data in my indicator.
Nothing is copied. Variables copied1/2 are always less than zero. In the debugger I can't get any further than this code. How to do it correctly, my head is already broken.