Can MT4 or MT5 automatically save tick timeframe and custom timeframe price into a csv file?

 

Hello, this is my first time here, so apology if this is a dumb question. But is there anyway to make MT4 or MT5 automatically save every price changes (or the current price once every n seconds) into a csv file, line-by-line (Updating and adding to the csv file every single time there's an update and not overwriting it)? And if those functionalities aren't already built into MT4 or MT5, is it possible to write a script for that in MQL?

Reason: