Errors, bugs, questions - page 1996

 
Slava:
Who's stopping it?

MQL5 does not allow it.

 
fxsaber:

MQL5 does not allow it.

Who said: "It doesn't"? Try, for example, like this

ChartSaveTemplate(chart_id,"\\Files\\MyPreferredTemplates\\cewl.tpl");
 
Slava:

Who said: "Doesn't allow it"? Try this, for example

You should try it yourself. It doesn't allow.

 
fxsaber:

You should try it yourself. Doesn't allow it.

Tried again (what if?).

It does

 
Slava:

Tried again (what if?).

Allows

You don't seem to have a 1653 build.

void OnStart()
{
  Print(ChartSaveTemplate(0, "\\Files\\MyPreferredTemplates\\cewl.tpl"));
  Print(TerminalInfoInteger(TERMINAL_BUILD));
}


Result

false
1653
 
fxsaber:

I wondered if this is the right thing to do, since it generates such VERY hard-to-detect errors.

The very fact that the program is not working correctly is extremely hard to catch. Then to find out the reason, you have to reproduce the error, which is just as hard. And then you have to dig through a huge code where an initialization of some variable is incomplete - horrible. Warnings help a lot with this. But only simple cases. Such cases as initialization not for the whole array are unrealistic to check at the compilation stage.

Perhaps your thoughts are of something else, but in this particular case the programmer's trivial inattention led to this error.

Won't you be annoyed by a few meters long string of warnings?

 
fxsaber:

You don't seem to have a 1653 build.


Result

Apparently the MyPreferredTemplates folder is missing. And the folder is not created when saving. Removed the folder from the path and this is the result.

2017.09.11 14:59:51.538 00 (EURUSD,H1)  true
2017.09.11 14:59:52.328 00 (EURUSD,H1)  1653
 
Alexey Viktorov:

Apparently the MyPreferredTemplates folder is missing. And when I save it, it doesn't create a folder. Removed the folder from the path and this is the result.

Thanks, I wouldn't have guessed that! It's working now. Before that, I tried "..\\..\\Files\\\template.tpl" - it didn't work the same way. What does the slash before Files mean that"\\\Files\\\template.tpl" works? How could I have guessed that?

 
fxsaber:

You don't seem to have a 1653 build.


Result

Has been working since build 1565. As of March 2017.

GetLastError returns what?

 
fxsaber:

Thanks, I wouldn't have guessed that! It's working now. Before that, I tried "..\\..\\Files\\\template.tpl" - it didn't work the same way. What does the slash before Files mean that"\\\Files\\\template.tpl" works? How could I have guessed that?

The slash at the beginning of the file name means "from the root of MQL5"
Reason: