on mt4 - it seems to me that ChartSaveTemplate(...) works with errors, build 1280
here's the script:
//+------------------------------------------------------------------+//| Test.mq4 |//| Copyright 2006-2015, MetaQuotes Software Corp. |//| http://www.metaquotes.net |//+------------------------------------------------------------------+#property copyright"2006-2015, MetaQuotes Software Corp."#property link"http://www.mql4.com"#property strict#property show_inputs
voidOnStart()
{
string s_Symbol = Symbol();
string s_EA_Name = "eStomper_02";
string s_MagicChartIDSuffix = "MagicChart";
int i_Magic = 1;
string s_GlobalMagicChartID;
string s_Period = _Period;
s_GlobalMagicChartID = StringConcatenate(s_EA_Name,"-",s_MagicChartIDSuffix,"-",i_Magic,"-",s_Symbol,"-",s_Period);
if(ChartSaveTemplate(0,s_GlobalMagicChartID))
{
Print("s_GlobalMagicChartID=",s_GlobalMagicChartID);
}
else
{
Print(__FUNCTION__," Couldnot Save template : " + s_GlobalMagicChartID + ".tpl" + "Error = " + GetLastError());
return;
}
}
//+------------------------------------------------------------------+
для М1 и М5 имя шаблона усекается, _Period - в имени шаблона не присутсвует..смотрю полный игнор, но вот если сделать так, то все в порядке. явно в компиляторе ошибка, что-то типа неправильного выравнивания.
Can you tell me, what algorithm is used to form the name of opt-files?
This is MD5 from values of input parameters of the Expert Advisor (for the optimized ones - start-step-stop, for the non-optimized ones - current value)
Среди программ для автоматического трейдинга можно выделить две большие категории: торговые роботы и индикаторы. Первые предназначены для совершения торговых операций на рынках, а вторые — для анализа котировок и выявления закономерностей в их изменении. При этом индикаторы могут использоваться непосредственно в роботах, образуя полноценную...
Question for clarification. How do I know the symbol and timeframe of an indicator by its handle?
There isIndicatorParameters function in MQL API to read indicator parameters, but it is not enough: what is the point of knowing, for example, period, if the symbol and timeframe are not known? I am not sure if this is an omission or I cannot find how to do this - please give me the link.
Question for clarification. How do I know the symbol and timeframe of an indicator by its handle?
There is IndicatorParameters function in MQL API to read indicator parameters, but it is not enough: what is the point of knowing, for example, period, if the symbol and timeframe are not known? If there is an error or I cannot find how to do it, please give me the link.
Igor Makanu:
no way
Yes, you can.
bool FindIndicatorByHandle(long handle, string &symbol, ENUM_TIMEFRAMES &timeframe, long &ChartId, int &sub_win, string &Name) {
long chart_id =ChartFirst();
while (chart_id!=-1) {
int total_sub = (int)ChartGetInteger(chart_id,CHART_WINDOWS_TOTAL);
int total_ind;
for(int i=0; i<total_sub; i++) {
total_ind = ChartIndicatorsTotal(chart_id,i);
for (int j=0; j<total_ind; j++) {
string name = ChartIndicatorName(chart_id,i,j);
if (ChartIndicatorGet(chart_id,i,name)== handle) {
ChartId=chart_id;
symbol= ChartSymbol(chart_id);
timeframe=ChartPeriod(chart_id);
sub_win=i;
Name=name;
returntrue;
}
}
}
chart_id=ChartNext(chart_id);
}
returnfalse;
}
but anyway, it is easier to bind the indicator handle directly to the indicator name in your code, although it may be the task to find out what the user has launched
Can you tell me what algorithm is used to form the name of the opt-files?
on mt4 - it seems to me that ChartSaveTemplate(...) works with errors, build 1280
here's the script:
Can you tell me, what algorithm is used to form the name of opt-files?
This is MD5 from values of input parameters of the Expert Advisor (for the optimized ones - start-step-stop, for the non-optimized ones - current value)
42 - real ticks, optimization by symbols
is it possible to control this figure via MQL? (this is the box from the line on the chart in MT)
With the help of this library
many thanks
Question for clarification. How do I know the symbol and timeframe of an indicator by its handle?
There isIndicatorParameters function in MQL API to read indicator parameters, but it is not enough: what is the point of knowing, for example, period, if the symbol and timeframe are not known? I am not sure if this is an omission or I cannot find how to do this - please give me the link.
Question for clarification. How do I know from an indicator handle the symbol and timeframe it was created for?
no way
i can't. Last year@fxsaber asked the same question, but with respect to files - how to know the file name from a handle, there is no solution
I found a suggested container for a file handle from@fxsaber
Question for clarification. How do I know the symbol and timeframe of an indicator by its handle?
There is IndicatorParameters function in MQL API to read indicator parameters, but it is not enough: what is the point of knowing, for example, period, if the symbol and timeframe are not known? If there is an error or I cannot find how to do it, please give me the link.
no way
Yes, you can.
I am attaching the test script.
The result of the script work:
You can.
Your code will probably work
I never usedChartIndicatorGet(), only now I found it in the reference
but anyway, it is easier to bind the indicator handle directly to the indicator name in your code, although it may be the task to find out what the user has launched
thanks! interesting