//+------------------------------------------------------------------+//| apply_template.mq5 |//| Copyright 2014, byJJ |//| http://ideiasparainvestir.com |//+------------------------------------------------------------------+#property copyright"Copyright 2014, by JJ"#property link"http://ideiasparainvestir.com"#property version"1.00"#property script_show_inputs#property description"Simple Script for Apply Template and/or timeframe in all charts opened"#include <Charts\Chart.mqh>;
inputENUM_TIMEFRAMES tempo_grafico; // Change TimeFrame - Current = dont changedinputstring template_name="D"; // Name of Template (without '.tpl')//+------------------------------------------------------------------+//| Script program start function |//+------------------------------------------------------------------+voidOnStart()
{
long currChart,prevChart=ChartFirst();
int i=0,limit=100;
bool errTemplate;
while(i<limit)
{
currChart=ChartNext(prevChart); // Obter o ID do novo gráfico usando o ID gráfico anterior// Se o tempo grafico e diferente aplica a todosif(tempo_grafico!=PERIOD_CURRENT)
{
ChartSetSymbolPeriod(prevChart,ChartSymbol(prevChart),tempo_grafico);
}
// Aplica a template
errTemplate=ChartApplyTemplate(prevChart,template_name+".tpl");
if(!errTemplate)
{
Print("Erro ao adicionar a template a ",ChartSymbol(prevChart),"-> ",GetLastError());
}
if(currChart<0) break; // Ter atingido o fim da lista de gráficoPrint(i,ChartSymbol(currChart)," ID =",currChart);
prevChart=currChart;// vamos salvar o ID do gráfico atual para o ChartNext()
i++;// Não esqueça de aumentar o contador
}
}
//+------------------------------------------------------------------+
is great, but my problem is when i want to apply it to chart a popup windows appear and then after it i should press ok then it run. simply i want this popup windows delete and script run without any verification or modification window
hello,
this below script:
https://www.mql5.com/en/code/11922
is great, but my problem is when i want to apply it to chart a popup windows appear and then after it i should press ok then it run. simply i want this popup windows delete and script run without any verification or modification window