Closed cychrn closed 3 years ago
Hi, Thank you for your feedback. I will investigate this problem and will let you know about some possible fix of it.
Thank you very much! Awaiting for your reply.
Hi, please provide type of exception that you got during call function ChartApplyTemplate.
After i check the exception thrown, the exception is thrown from something else as the MtApi could not connect properly to the chart (because the chart is not opened properly) but the code could still continue to execute like new tick occur and the program fire QuoteUpdate event.
the error would repeat if you run this code
NewChartID = MtApiClientA.ChartOpen(ChartToOpen, ENUM_TIMEFRAMES.PERIOD_M1);
//System.Threading.Thread.Sleep(Settings.AdminSettingChartOpenCloseWaitTime);
bool OperationResult;
if (MtApiClientA.ChartApplyTemplate(NewChartID, MT4TemplateFileName))
{
OperationResult = true;
}
else
{
OperationResult = false;
}
if this code is run without Thread.Sleep for about at least 1000 ms then surely the error occurs. But the error will not occur here. It will occur the next time MtApiClientA is accessed again.
@cychrn Hi. I am trying to reproduce your issue but can't. All is working fine on my side. My PC is fast so maybe it does not have this issue. I will try to test this case on slower PC.
Hello Vdemydiuk,
Greeting from Thailand! I am new to using MtApi and getting to love it so much! Thank you very much for your great work.
I am having a problem applying template of a chart after opening using OpenChart function. Sometimes the chart is opened very fast so template applying is successful but sometimes the chart open so slow and the code already apply the template causing exception thrown...
So, my question is, is there any way to check if the chart open by OpenChart is ready before executing the next line of code? Now i am using Thread.Sleep which would work for most of the graph, but it wait too long for normal forex chart and would still not long enough for some exotic chart...
Your guide will be very much appreciated.
Thank you very much!