MetaTrader 5 Python User Group - how to use Python in Metatrader - page 63
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
Will be available next beta version tonight:
https://www.mql5.com/en/forum/306742/page16#comment_16148685
I tried to run the start script - everything runs, prints an array of data on the trading pairs from the example, starts the window on which it draws the chart
But I tried to replace "EURAUD" with "DAX30", for example - after I ran the script, it says Failed to select DAX30
Please advise what may be the problem? Terminal version 2402
I do connection with the login and the password and a server to the demo account of the broker through mt5.initialize
https://www.mql5.com/ru/docs/integration/python_metatrader5
I tried to run the start script - everything runs, prints an array of data on the trading pairs from the example, runs a window on which it draws the chart
But I tried to replace "EURAUD" with "DAX30", for example - after I ran the script, it says Failed to select DAX30
Please advise what may be the problem? Terminal version 2402
I connect with login password and server to my broker's demo account via mt5.initialize
# let's try to enable display of DAX30 symbol in MarketWatch
selected = mt5.symbol_select("DAX30", True)
if not selected:
print("initialize() failed, error code = ", mt5 .last_error())
mt5 .shutdown()
quit()
this is the error (-1, 'Terminal: Call failed')
# let's try to enable the DAX30 symbol in MarketWatch
selected = mt5.symbol_select("DAX30", True)
if not selected:
print("initialize() failed, error code = ", mt5 .last_error())
mt5 .shutdown()
quit()
This is the error (-1, 'Terminal: Call failed')
Are you sure you have the DAX30 symbol in your trading account?
Show a screenshot of market overview with this symbol on your trading account, please.
Are you sure you have the DAX30 symbol in your trading account?
Show a screenshot of the market overview with this symbol on your trading account, please.
***
I take this code -https://www.mql5.com/ru/docs/integration/python_metatrader5/mt5copyratesrange_py, I initialize it by connecting it to my demo account. If I run it with USDJPY from the example - everything is OK, it displays a table. If I change it to DAX30
For rates in rates:
TypeError: 'NoneType' object is not iterable
https://prnt.sc/sbapam
I take this code and initialize it by connecting it to my demo account. If I run it with USDJPY from the example - everything is OK, it displays a table. If I change it to DAX30
For rates in rates:
TypeError: 'NoneType' object is not iterable
# let's try to enable the display of DAX30 symbol in MarketWatch
selected = mt5.symbol_select("DAX30", True)
if not selected:
print("initialize() failed, error code = ", mt5 .last_error())
mt5 .shutdown()
quit()
error like this (-1, 'Terminal: Call failed')
You have Dax30 in square brackets. The error you are being given is correct.
Ugh, never paid attention to that, thanks
And thanks to the developers for the opportunity to transfer the logic to a 3rd party language, specifically Python.
I will try to provide feedback here as logic is being analyzed and implemented.
Hi All,
I hope you don't mind an English man here. Looking for some guidance after spending lots of time searching the web without success.
I am using the MetaTrader5 Python library after some inspiration from Maxiums articles. I have noticed a problem with memory handling.
When I make a Dataframe using mt5 lib the resultant dataframe works as expected. I have done this within a function that collects the ticks and then performs various analysis before outputting the manipulated df.
However, if I rerun the function that creates the DataFrame I have noticed that the memory is just keeping accumulating from the previous instance.
I get the same problem using mt5.copy_ticks_range () and mt5.copy_rates_range (). I have to reset the kernel in order to clear out the memory.
I get the same problem even after removing all code except the line creating the dataframe. For instance:
def vel (symbol, lookback, lookforward, start_date, end_date, quantile_size):
ticks = pd.DataFrame (mt5.copy_ticks_range (symbol, datetime (start_date.year, start_date.month, start_date.day), datetime (end_date.year, end_date.month, end_date.day), mt5.COPY_TICKS_ALL), columns = [ 'time', 'bid', 'ask', 'last', 'volume', 'time_msc', 'flags', 'volume_real'])
If I run this several times the memory usage goes up 27MiB each time:
Line # Mem usage Increment Line Contents ================================================== 126.3 MiB 126.3 MiB def vel (symbol, lookback, lookforward, start_date, end_date, quantile_size): 153.3 MiB 26.9 MiB ticks = pd.DataFrame (mt5.copy_ticks_range (symbol, datetime (start_date.year, start_date.month, start_date.day), .
Line # Mem usage Increment Line Contents