Save current profile's charts to DISK via MQL

 

Hi, 

i know MT5 save current profile's charts to disk when it is closed, or we can do it manually File->Profiles->Save.

Is there a way to do it via MQL?

I would write a code to save the charts each XX seconds to prevent losing its data if unexpected crash (mt5 or windows or pc) happens.

Thanks.

 
I think no, but you can use ChartSaveTemplate and save all chart, it is same with save profile.
 
antony23:

Hi, 

i know MT5 save current profile's charts to disk when it is closed, or we can do it manually File->Profiles->Save.

Is there a way to do it via MQL?

I would write a code to save the charts each XX seconds to prevent losing its data if unexpected crash (mt5 or windows or pc) happens.

Thanks.

Read documentation: https://www.mql5.com/en/docs/chart_operations/chartscreenshot

Documentation on MQL5: Chart Operations / ChartScreenShot
Documentation on MQL5: Chart Operations / ChartScreenShot
  • www.mql5.com
"The Expert Advisor demonstrates how to create a series of screenshots of the current" "shown on the chart. The height and width of images is defined through macros." //| Expert initialization function                                   | //| Expert tick function                                             |...
 

Hi, 

I mean save .chr files in current profile directory, exactly as MT5 does when it is closed. I don't need screenshot neither .tpl files. 

I can't believe MQL5 don't have such a simple feature... 

 
antony23:

Hi, 

I mean save .chr files in current profile directory, exactly as MT5 does when it is closed. I don't need screenshot neither .tpl files. 

I can't believe MQL5 don't have such a simple feature... 

What you believe doesn't matter. There is no such function to work with MT5 profile.

However a profile is nothing else than a set of templates, except .chr extension is used instead of .tpl and an order.wnd text file is created which enumerates the charts template. So it's trivial to code your own SaveProfile() function.

 
Thanks, i'll go to save template!