I've creted a flask api to call copy_ticks_range. but when I called it It prints None, after that I called last_error() function and It's Says: (-10004, "No IPC connection") what is the meaning of this? Can anyone help me? (I also tried given example and gives same output)
Thank you!
Refer to the help documentation - take an example from the help documentation
After that, paste here (using the button ) your code and show the result of the code.Refer to the help documentation - take an example from the help documentation
After that, paste here (using the button ) your code and show the result of the code.how can I find the help documentation?
I tried the given example in this documentation. and its gives the same output
https://www.mql5.com/en/docs/integration/python_metatrader5/mt5copyticksrange_py
- www.mql5.com
how can I find the help documentation?
I tried the given example in this documentation. and its gives the same output
https://www.mql5.com/en/docs/integration/python_metatrader5/mt5copyticksrange_py
If you have a problem you must follow these steps:
- provide your code (paste the code using the button )
- provide the result (data from the log file)
- It is highly recommended to use the full code from the help!
Look at the help and your code: Your code does not match the help. Run full code from help. Don't think of anything. Test the full code from the help.
If you have a problem you must follow these steps:
- provide your code (paste the code using the button )
- provide the result (data from the log file)
- It is highly recommended to use the full code from the help!
Look at the help and your code: Your code does not match the help. Run full code from help. Don't think of anything. Test the full code from the help.
I wrote exact same function but gives the error as last error: (-10002, 'IPC recv failed')
here's my code:
from datetime import datetime import MetaTrader5 as mt5 import pytz # display data on the MetaTrader 5 package print("MetaTrader5 package author: ", mt5.__author__) print("MetaTrader5 package version: ", mt5.__version__) if not mt5.initialize(login=54604178, password="r5hfhqfq", server="MetaQuotes-Demo"): print("initialize() failed, error code =", mt5.last_error()) quit() else: print("Initialized") # set time zone to UTC timezone = pytz.timezone("Etc/UTC") # create 'datetime' objects in UTC time zone to avoid the implementation of a local time zone offset utc_from = datetime(2020, 1, 10, tzinfo=timezone) utc_to = datetime(2022, 3, 18, tzinfo=timezone) # request AUDUSD ticks within 11.01.2020 - 11.01.2020 ticks = mt5.copy_ticks_range("AUDUSD", utc_from, utc_to, mt5.COPY_TICKS_ALL) print(ticks) print("last error: " , mt5.last_error())
here's the output:
MetaTrader5 package author: MetaQuotes Ltd. MetaTrader5 package version: 5.0.37 Initialized None last error: (-10002, 'IPC recv failed')
Thank you in Advance !
I repeat for the third time: copy the example from the help - copy the example one by one, do not invent anything, do not change anything. Post the result.
Here is my result (I took the FULL example from the Documentation, I did not invent ANYTHING and did not change ANYTHING in the code):
2022.03.22 06:40:37.967 Python "C:\Users\barab\AppData\Local\Programs\Python\Python310\python.exe" -u "C:\Users\barab\AppData\Roaming\MetaQuotes\Terminal\D0E8209F77C8CF37AD8BF550E51FF075\MQL5\Scripts\Python\copy_ticks_range.py" EURUSD 60 2022.03.22 06:40:38.199 Python MetaTrader5 package author: MetaQuotes Ltd. 2022.03.22 06:40:38.199 Python MetaTrader5 package version: 5.0.36 2022.03.22 06:40:38.543 Python Ticks received: 68959 2022.03.22 06:40:38.543 Python Display obtained ticks 'as is' 2022.03.22 06:40:38.543 Python (1578614700, 0.68566, 0.68588, 0., 0, 1578614700106, 134, 0.) 2022.03.22 06:40:38.543 Python (1578614700, 0.68567, 0.68587, 0., 0, 1578614700226, 134, 0.) 2022.03.22 06:40:38.543 Python (1578614700, 0.68567, 0.68585, 0., 0, 1578614700329, 4, 0.) 2022.03.22 06:40:38.543 Python (1578614715, 0.68567, 0.68587, 0., 0, 1578614715258, 4, 0.) 2022.03.22 06:40:38.558 Python (1578614715, 0.68566, 0.68587, 0., 0, 1578614715455, 130, 0.) 2022.03.22 06:40:38.558 Python (1578614715, 0.68562, 0.68587, 0., 0, 1578614715712, 130, 0.) 2022.03.22 06:40:38.558 Python (1578614715, 0.68562, 0.68585, 0., 0, 1578614715845, 4, 0.) 2022.03.22 06:40:38.558 Python (1578614716, 0.68566, 0.68585, 0., 0, 1578614716213, 130, 0.) 2022.03.22 06:40:38.558 Python (1578614716, 0.68566, 0.68586, 0., 0, 1578614716345, 4, 0.) 2022.03.22 06:40:38.558 Python (1578614716, 0.68567, 0.68584, 0., 0, 1578614716450, 134, 0.) 2022.03.22 06:40:38.558 Python 2022.03.22 06:40:38.558 Python Display dataframe with ticks 2022.03.22 06:40:38.558 Python time bid ask last volume time_msc flags volume_real 2022.03.22 06:40:38.558 Python 0 2020-01-10 00:05:00 0.68566 0.68588 0.0 0 1578614700106 134 0.0 2022.03.22 06:40:38.558 Python 1 2020-01-10 00:05:00 0.68567 0.68587 0.0 0 1578614700226 134 0.0 2022.03.22 06:40:38.558 Python 2 2020-01-10 00:05:00 0.68567 0.68585 0.0 0 1578614700329 4 0.0 2022.03.22 06:40:38.558 Python 3 2020-01-10 00:05:15 0.68567 0.68587 0.0 0 1578614715258 4 0.0 2022.03.22 06:40:38.558 Python 4 2020-01-10 00:05:15 0.68566 0.68587 0.0 0 1578614715455 130 0.0 2022.03.22 06:40:38.558 Python 5 2020-01-10 00:05:15 0.68562 0.68587 0.0 0 1578614715712 130 0.0 2022.03.22 06:40:38.558 Python 6 2020-01-10 00:05:15 0.68562 0.68585 0.0 0 1578614715845 4 0.0 2022.03.22 06:40:38.558 Python 7 2020-01-10 00:05:16 0.68566 0.68585 0.0 0 1578614716213 130 0.0 2022.03.22 06:40:38.558 Python 8 2020-01-10 00:05:16 0.68566 0.68586 0.0 0 1578614716345 4 0.0 2022.03.22 06:40:38.558 Python 9 2020-01-10 00:05:16 0.68567 0.68584 0.0 0 1578614716450 134 0.0
- www.mql5.com
I repeat for the third time: copy the example from the help - copy the example one by one, do not invent anything, do not change anything. Post the result.
Here is my result (I took the FULL example from the Documentation, I did not invent ANYTHING and did not change ANYTHING in the code):
Thank you! I run the exact given example and its working but when I change the utc_to date to (2021, 5, 11) its not working! Do you have any idea why is that? is this function work for time duration only for one year ?
Thank you in advance!
Thank you! I run the exact given example and its working but when I change the utc_to date to (2021, 5, 11) its not working! Do you have any idea why is that? is this function work for time duration only for one year ?
Thank you in advance!
Absolutely everything works and there are no errors. You need to look for the error in yourself. And in general: you must first learn the MQL5 language and only after that try to do something in python!
I repeat for the third time: copy the example from the help - copy the example one by one, do not invent anything, do not change anything. Post the result.
Here is my result (I took the FULL example from the Documentation, I did not invent ANYTHING and did not change ANYTHING in the code):
Hello,
I get the same error. I copied and pasted the full code from the help as you suggested.
I received this output:
MetaTrader5 package author: MetaQuotes Ltd. MetaTrader5 package version: 5.0.37 initialize() failed, error code = (-6, 'Terminal: Authorization failed')
--------------------------------------------------------------------------- TypeError Traceback (most recent call last) <ipython-input-1-2717d31e47d1> in <module>() 24 # request AUDUSD ticks within 11.01.2020 - 11.01.2020 25 ticks = mt5.copy_ticks_range("AUDUSD", utc_from, utc_to, mt5.COPY_TICKS_ALL) ---> 26 print("Ticks received:",len(ticks)) 27 28 # shut down connection to the MetaTrader 5 terminal TypeError: object of type 'NoneType' has no len()
Hello,
I get the same error. I copied and pasted the full code from the help as you suggested.
I received this output:
MetaTrader5 package author: MetaQuotes Ltd. MetaTrader5 package version: 5.0.37 initialize() failed, error code = (-6, 'Terminal: Authorization failed')
Read the title of the error. Start fixing one mistake at a time.
Run the python script not from MetaEditor, but from MetaTrader 5.Hello,
I get the same error. I copied and pasted the full code from the help as you suggested.
I received this output:
MetaTrader5 package author: MetaQuotes Ltd. MetaTrader5 package version: 5.0.37 initialize() failed, error code = (-6, 'Terminal: Authorization failed')
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I've creted a flask api to call copy_ticks_range. but when I called it It prints None, after that I called last_error() function and It's Says: (-10004, "No IPC connection") what is the meaning of this? Can anyone help me? (I also tried given example and gives same output)
Thank you!
And My Code is: