
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
Hello dear friends ,
I am a beginner user in meta trader , I am so interested in using python API for my trading tasks,
but when I was trying to load all the symbols by
symbols=mt5.symbols_get()
it return None as symbols but when I wrote in other script
rates = mt5.copy_rates_from("غسالم", mt5.TIMEFRAME_D1, utc_from)
it gives corresponding data to غسالم and works well .
because I want to trade on all symbols and filter them it is mandatory to access their list but unfortunately the symbols_get is not working . please help me to find solution
my broker : Mofid
and symbols are written in Persian.
Your terminal needs to be upgraded to the latest beta version. Sign in to a MetaQuotes Demo account then go to Help>Check for updates. One thing to note is that the MetaTrader5 package will never raise an exception so you have to ask if there were any errors after operations by calling last_error(). If you want to use standard python conventions you can use the pymt5adapter instead so you can encapsulate your code in try: except...
Thank you for adding the sys.argv feature! That's awesome and will definitely help with scripts that are dropped on the chart. Thanks for all the hard work making that happen. I am having an issue with the implentation, however. The values returned for the timeframes are unexpected. Instead of returning the timeframe const enum value, I am getting the equivalent of the number of minutes in the period. This is unexpected given the API has different values for the timeframes. Example:
The output when running this example script on an H1 chart:
Thank you for adding the sys.argv feature! That's awesome and will definitely help with scripts that are dropped on the chart. Thanks for all the hard work making that happen. I am having an issue with the implentation, however. The values returned for the timeframes are unexpected. Instead of returning the timeframe const enum value, I am getting the equivalent of the number of minutes in the period. This is unexpected given the API has different values for the timeframes. Example:
The output when running this example script on an H1 chart:
I updated the pymt5adapter package and added a function named parse_args which will automatically convert the minutes being passed by the terminal to the appropriate timeframe.
To update:
Thank you for adding the sys.argv feature! That's awesome and will definitely help with scripts that are dropped on the chart. Thanks for all the hard work making that happen. I am having an issue with the implentation, however. The values returned for the timeframes are unexpected. Instead of returning the timeframe const enum value, I am getting the equivalent of the number of minutes in the period. This is unexpected given the API has different values for the timeframes. Example:
The output when running this example script on an H1 chart:
Hi everyone.
i just wanted to ask a question regarding python integration with metatrader...
i am trying to initialize metatrader 5 via python (with predefined login details), everything works nice for the same broker account, but as soon as i try and initialize the metatrader with the login details from some other broker , then it does not login the account
for eg.
if i have BrokerABC metatrader platform installed
and When i run the script with this code with the server address and login and password of "Broker ABC" account, everything works great:
But when i run the script with this code containing the account login details of some other broker(XYZBroker), on the Broker ABC platform
it opens up the metatrader platform , but it does not login the account
any suggestions , why it wont login the account from any other broker on a different broker's metatrader platform?
Hi everyone.
i just wanted to ask a question regarding python integration with metatrader...
i am trying to initialize metatrader 5 via python (with predefined login details), everything works nice for the same broker account, but as soon as i try and initialize the metatrader with the login details from some other broker , then it does not login the account
for eg.
if i have BrokerABC metatrader platform installed
and When i run the script with this code with the server address and login and password of "Broker ABC" account, everything works great:
But when i run the script with this code containing the account login details of some other broker(XYZBroker), on the Broker ABC platform
it opens up the metatrader platform , but it does not login the account
any suggestions , why it wont login the account from any other broker on a different broker's metatrader platform?
You have to check the value of MetaTrader5.last_error.
You have to check the value of MetaTrader5.last_error.
hi nicholi shen thanks for replying.
i did check the errors , but there is nothing i can find about it, here is the error that python ide shows :
initialize() failed, error code = (-10003, "IPC initialize failed, Pipe server didn't answer in 60 sec")
running the python code does open up the metatrader platform , but it does not login with the provided details, but when i manually go to the metatrader and click on accounts-> login-> and enter the same login details from the python script then it successfully login the account
hi nicholi shen thanks for replying.
i did check the errors , but there is nothing i can find about it, here is the error that python ide shows :
initialize() failed, error code = (-10003, "IPC initialize failed, Pipe server didn't answer in 60 sec")
running the python code does open up the metatrader platform , but it does not login with the provided details, but when i manually go to the metatrader and click on accounts-> login-> and enter the same login details from the python script then it successfully login the account
i did something like this :
but still nothing...
it launches the mertatrader and try to login with the details , but never logs in the account...
this is what happens: https://paste.pics/299c254cdd8b42cc0a2203f9ea118a2c
Do you mean to replace the current initialization code with the code you provided ?
i did something like this :
but still nothing...
it does not login the account and it returns this in the python IDE :
If everything works when you call initialize without args but breaks when you try and call it with args, then you are inputting something wrong.