MetaTrader 5 Python User Group - how to use Python in Metatrader - page 66
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
What were the current prices (Bid and Ask)? What was the freeze level (SYMBOL_TRADE_FREEZE_LEVEL)?
Not sure about the FREEZE levels?
Ask price is being used for my buy and bid price for my shorts.
I have tried hardcoding my sl and tp now.
Just strange that it will Buy and Sell perfect for hours and then stop.
Still writes:
if r.retcode != TRADE_RETCODE_REQUOTE and r.retcode != TRADE_RETCODE_PRICE_OFF:
AttributeError: 'NoneType' object has no attribute 'retcode'
Run Help Example for https://www.mql5.com/ru/docs/integration/python_metatrader5/mt5ordersend_py
Example from help works.
I used an example in my function and wrote:
if result_buy.retcode != mt5.TRADE_RETCODE_DONE:
AttributeError: 'NoneType' object has no attribute 'retcode'
It still writes:
The example from the help works.Applying the example in my function, it says:
if result_buy.retcode != mt5.TRADE_RETCODE_DONE:
AttributeError: 'NoneType' object has no attribute 'retcode'
So you got result_buy==None, didn't check the value and tried to get the retcode from None?
The new MT5-terminal beta along with the MetaTrader5 5.0.31 can only sustain about 7700 calls to copy_rates_from_pos() before it completely locks up the thread. In order to demonstrate this bug I have implemented a timeout using asyncio. The timeout works on the control, however, it does not work for copy_rates_from_pos because the thread completely freezes due to the bug.
Even shutting down and re-initialising the connection doesn't help.
There is a bug in copy rates. I posted this several times but nobody has acknowledged it.
Question: What is this cycle for?
Question: Why this cycle?
I was getting failures requesting maxbars as the "count" parameter so I wrote a simple routine that grows the number of bars requested on each iteration as a unit-test to test the function. This should complete without issues, but given that you can only call it a finite number of times makes it unreliable.
I was getting failures requesting maxbars as the "count" parameter so I wrote a simple routine that grows the number of bars requested on each iteration as a unit-test to test the function. This should complete without issues, but given that you can only call it a finite number of times makes it unreliable.
Still writes:
if r.retcode != TRADE_RETCODE_REQUOTE and r.retcode != TRADE_RETCODE_PRICE_OFF:
AttributeError: 'NoneType' object has no attribute 'retcode'
Example from help works.
Applying an example in my function, it says
if result_buy.retcode != mt5.TRADE_RETCODE_DONE:
AttributeError: 'NoneType' object has no attribute 'retcode'
ckeiderling:
...
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.
...