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
I integrated Python perfectly with Metatrader 5.
At my Brazilian broker everything works fine, without delay.
I tested it at Forex brokerages ICMarkets, Activ and XM and it doesn't work well. All have a delay of 2 hours (120 minutes). I've done several tests and researches and I can't solve it.
I contacted the ICMarkets chat and they don't support it. I asked if this is on purpose and they said no.
Someone knows how to solve this problem. Because I run out of data for the past 2 hours.
I took the images on a Sunday, in the first hour of EURUSD's opening, as you can see the data obtained by Python is from last Friday. But as a rule the delay is 2 hours.
Follow the code below for testing:
from datetime import datetime
import MetaTrader5 as mt5
# estabelecemos a conexão ao MetaTrader 5
if not mt5.initialize():
print("initialize() failed, error code =",mt5.last_error())
quit()
data = mt5.copy_rates_from('EURUSD', mt5.TIMEFRAME_M1, datetime.today(), 10)
mt5.shutdown()
# a partir dos dados recebidos criamos o DataFrame
rates_frame = pd.DataFrame(data)
# convertemos o tempo em segundos no formato datetime
rates_frame['time']=pd.to_datetime(rates_frame['time'], unit='s')
rates_frame