Forum

copy_rates_from_pos will randomly not return the correct candles

I pull my candles in this way: lines = mt5. copy_rates_from_pos (chart, mt5.TIMEFRAME_M5, 0, 25) It should return the last 25 candles. Sometimes it does, sometimes it doesn't. Success output: [2023.09.19 05:01:00] [***]chart=EURUSD+ lenlines=25 [2023.09.19 05:01:00] x=0 linestamp=300

MT5 API copy_rates_from returns nothing

Hello, I'm trying to pull candle data, copy_rates_from and copy_rates_from_pos return no data. Snippet of my code: timezone = pytz.timezone('US/Eastern') utc_from = datetime.datetime(2023, 1, 1, tzinfo=timezone) rates = mt5.copy_rates_from("EURUSD", mt5.TIMEFRAME_M5, utc_from, 100) for rate in