Hi All,
I have some issue trying to apply template to charts that I open using my script. The charts open but the template don't apply when I use ChartApplyTemplate
Here is the code.
{
...
if(ShowChart && TradeSig)
{
ChartOpen(FX_Pairs[i], PERIOD_D1);
ChartApplyTemplate(0, "\\kiss.tpl");
}
}
Do you have a template with that name inside 'terminal_data_path\MQL5' or inside 'terminal_path\Profiles\templates' ?.
In the other hand, 0 denotes the current chart. If you have a template with that name, it would apply to the current chart, and not to the new opened chart. You would have to replace 0 by the new chart ID. Example:
long chart = 0;
For loop
{
...
if(ShowChart && TradeSig)
{
chart = ChartOpen(FX_Pairs[i], PERIOD_D1);
if(chart > 0)
{
ResetLastError();
PrintFormat("Failed to apply template to %I64d, error code: %d", chart, GetLastError());
else
ChartRedraw(chart);
}
}
}
Regards
Do you have a template with that name inside 'terminal_data_path\MQL5' or inside 'terminal_path\Profiles\templates' ?.
In the other hand, 0 denotes the current chart. If you have a template with that name, it would apply to the current chart, and not to the new opened chart. You would have to replace 0 by the new chart ID. Example:
long chart = 0;
For loop
{
...
if(ShowChart && TradeSig)
{
chart = ChartOpen(FX_Pairs[i], PERIOD_D1);
if(chart > 0)
{
ResetLastError();
PrintFormat("Failed to apply template to %I64d, error code: %d", chart, GetLastError());
else
ChartRedraw(chart);
}
}
}
Regards
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi All,
I have some issue trying to apply template to charts that I open using my script. The charts open but the template don't apply when I use ChartApplyTemplate
Here is the code.
{
...
if(ShowChart && TradeSig)
{
ChartOpen(FX_Pairs[i], PERIOD_D1);
ChartApplyTemplate(0, "\\kiss.tpl");
}
}