MQL5Book/Scripts/p5/ChartDuplicate.mq5
super.admin 1c8e83ce31 convert
2025-05-30 16:09:41 +02:00

26 lines
974 B
MQL5

//+------------------------------------------------------------------+
//| ChartDuplicate.mq5 |
//| Copyright 2021, MetaQuotes Ltd. |
//| https://www.mql5.com |
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+
//| Script program start function |
//+------------------------------------------------------------------+
void OnStart()
{
const string temp = "/Files/ChartTemp";
if(ChartSaveTemplate(0, temp))
{
const long id = ChartOpen(NULL, 0);
if(!ChartApplyTemplate(id, temp))
{
Print("Apply Error: ", _LastError);
}
}
else
{
Print("Save Error: ", _LastError);
}
}
//+------------------------------------------------------------------+