Questions from Beginners MQL5 MT5 MetaTrader 5 - page 903
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
Stupidly made a script to copy inside the computer.... Doesn't copy!!!
So where is the error description? What operating system? What build of MetaTrader 5?
Do you have write rights to the folder?
Added: it looks like if there is no directory, it needs to be created first.
When copying to existing directory - no problem. MetaTrader 5 will work without errors.
How can I be sure that the position with the given id has closed?
The obvious solution - when PositionSelectByTicket returns false, but this can probably happen in a situation where the open positions have not had time to be loaded into the terminal when connected to the trading account?
A slightly more complicated solution - PositionSelectByTicket returns false and HistorySelectByPosition returns true. In this case, if the history for this position is loaded, then the list of open positions must be loaded.
Wait for the terminal to synchronise. For example, while(HistorySelect).
Wait for the terminal to synchronise. For example, while (HistorySelect).
I'm not an expert in the inner workings of the terminal. But maybe it's gaoanted that when OnInit comes, the table of open positions (and possibly trading history) is already loaded?
I am not an expert in the inner workings of the terminal.
Also far from an expert. It's just that several options come to mind to try out at once. And what will work will have to be experimented with.
The easiest solution: open a chart of the desired financial instrument in MetaTrader and place the Expert Advisor on it.
This is known. But I want to know how to set the pair in the application ? Is there a function for this ?
Easily.
For example, trade operations. SeeCTrade trade class,Buy method:
I have highlighted the place where you can specify the required symbol.
Or for example receiving data about opening and closing prices... -CopyRates:
Easily.
For example, trade operations. SeeCTrade trade class,Buy method:
I have highlighted the place where you can specify the required symbol.
Or for example receiving data about opening, closing prices ... -CopyRates:
Yes, ok. But I haven't specified that I want to assign a pair at startup, but
without opening position. And Buy does it by opening a position,
andCopyRates giveshistorical data of the pair without assigning it.
Yes, okay. But I didn't specify that I want to assign a couple when starting up, but
without opening a position. And Buy does this by opening a position,
andCopyRates giveshistorical data of pair without assigning it.
You are being florid, but I'll try to guess: you need an input parameter with the symbol name? Then here's the code - you specify the desired symbol in the"InpSymbol" parameter. This symbol is checked in OnInit() - if there is no such a symbol, then the Expert Advisor will be unloaded and an error message will appear in the "Experts" tab of the terminal (or in the "Journal" tab of the Strategy Tester).
If a symbol specified in the"InpSymbol" parameter exists, then the following information will be displayed on the chart
Here is how it works: we start it on EURUSD and specify the USDJPY symbol in the settings. So, it works with the EURUSD symbol, but the data (prices) comes from USDJPY
You're being a bit florid, but let me guess: you need an input parameter with a symbol name? Then here is the code - you specify the desired symbol in the"InpSymbol" parameter. This symbol is checked in OnInit() - if there is no such a symbol, then the Expert Advisor will be unloaded and an error message will appear in the "Experts" tab of the terminal (or in the "Journal" tab of the Strategy Tester).
If a symbol specified in the"InpSymbol" parameter exists, then the following information will be displayed on the chart
Here is how it works: we start it on EURUSD and specify the USDJPY symbol in the settings. So, it works with EURUSD symbol, but the information (prices) comes from US
You're being florid, but let me guess: you need an input parameter with the symbol name? Then here's the code - you specify the required symbol in the"InpSymbol" parameter. This symbol is checked in OnInit() - if there is no such a symbol, then the Expert Advisor will be unloaded and an error message will appear in the "Experts" tab of the terminal (or in the "Journal" tab of the Strategy Tester).
If a symbol specified in the"InpSymbol" parameter exists, then the following information will be displayed on the chart
Here is how it works: we start it on EURUSD and specify the USDJPY symbol in the settings. So, it turns out that it works with the EURUSD symbol, but receives information (prices) from the USDJPY symbol
Yes, but in this example, the Expert Advisor runs on EURUSD, but the information (prices) is obtained from the USDJPY symbol.
Why complicate things, I mean, if we take this example, then we launch the Expert Advisor on EURUSD ( or any other
needed currency pair) and that's it, we observe this pair, and then, if necessary, we open a position.