Errors, bugs, questions - page 3190

 
MT5 high CPU usage after copy_rates_from_pos loop in Python.

The loop stopped:

MT5 at taskmanager: ~20% to 40% CPU use. Shouldn't return to ~0?

 (more than 10 min after the code run and in idle). I have to manually close the Meta Trader to tame the CPU.

Before run the script: CPU and MT5 at ~1%.

import MetaTrader5 as mt5, MetaTrader5
from datetime import datetime, timedelta
import time
import pandas as pd

mt5.initialize()

symbols=mt5.symbols_get()


# simplified test
for x in symbols[:2000]:
    print(mt5.copy_rates_from_pos( x.name, mt5.TIMEFRAME_M1, 0, 1))

mt5.shutdown() return as True, but CPU usage continues high. 

Market Watch cleaned.

No chart or indicator, nothing.

Tested on VS Code and pure Python console
MT5 5.00 build(4424)


Files: