MT5 high CPU usage after copy_rates_from_pos loop in Python

 

Before run the script: CPU cool at ~1%

During the loop: ramp up ok

After the loop stopped: ~20% to 40%.
 (more than 10 min after the code run and in idle). I have to manually close the Meta Trader every time.

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


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))



    


    


    


VS Code
MT5 5.00 build(4424)


Is it a bug or a feature? 😅




Files:
 

Please, can someone help and try to replicate this?


Is it my machine or a MT5 bug?