"The extern memory class defines an external variable. The extern modifier is specified before the data type. Extern variables define the input parameters of a program, they are accessible from the program properties window. Arrays cannot act as external variables. "
Thank you very much, I won't say no. :-) I'll write you my email address in ICQ, give me the number. I'll tell you this: I just responded first, others came to see the answer and did not add anything. So do not think that everyone here is so angry and do not want to share knowledge.
Эксперт: iCustom("USDJPY", ...
А индикатор откуда об этом знает? Лучше добавить в секцию extern индикатора строковую переменную вроде
extern string SymbolName = "USDJPY"; // инструмент по умолчанию
и вызывать стохастик так
Stochastic[i]=iStochastic(SymbolName, 0, ...
(Опять какие-то глюки форума. В Лисе стрелки не работают, оттго и пишу не по-людски)
#propertyindicator_separate_window#propertyindicator_buffers3#propertyindicator_color1Yellow#propertyindicator_color2Red#propertyindicator_color3Red#propertyindicator_minimum0#propertyindicator_maximum100//---- input parameters//extern string st="---Параметры Stochastic---";
extern string SymbolName = "USDJPY";
extern int TimeFrame = 0;
externintKPeriod =12;
externintDPeriod =3;
externintSlowing =2;
//extern string en="---Параметры Envelopes---";externintEnvPeriod=17;
externintDeviation=15;
externintShift=1;
//---- buffersdoubleStochastic[];
doubleUP[];
doubleLOW[];
//+------------------------------------------------------------------+//| Custom indicator initialization function |//+------------------------------------------------------------------+intinit(){//---- indicatorsSetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(0,Stochastic);
SetIndexStyle(1,DRAW_LINE);
SetIndexBuffer(1,UP);
SetIndexStyle(2,DRAW_LINE);
SetIndexBuffer(2,LOW);
//----return(0);
}intdeinit(){return(0);
}//+------------------------------------------------------------------+//| Custom indicator iteration function |//+------------------------------------------------------------------+intstart(){intlimit;
intcounted_bars=IndicatorCounted();
//---- последний посчитанный бар будет пересчитанif(counted_bars>0)counted_bars--;
limit=Bars-counted_bars;
//---- основной циклfor(inti=limit-1; i>=0; i--) // индикаторы лучше рассчитывать слева направо{Stochastic[i]=iStochastic(SymbolName, TimeFrame,KPeriod,DPeriod,Slowing,MODE_SMA,0,MODE_MAIN,i);
}for(i=limit-1; i>=0; i--) // см. примечание{UP[i] =iMAOnArray(Stochastic,0, EnvPeriod, Shift,MODE_SMA,i)+Deviation;
LOW[i]=iMAOnArray(Stochastic,0, EnvPeriod, Shift,MODE_SMA,i)-Deviation;
)
return(0);
}
Вызов из эксперта:
iCustom("USDJPY", 0, ...
С iMAOnArray вообще надо обращаться аккуратно. Например, поэкспериментировать с порядком ее расчета.
А лучше всего такие вещи делать самому. Кстати, для мультивалютного эксперта может потребоваться везде
явно задавать имя символа и рабочий тайм-фрейм, чтобы избежать умолчательных сюрпризов вроде этого.
In a multi-currency EA when calling the iCustom indicator for a specific symbol, it is better to provide the following in the indicator itself
extern string SymbolName = "USDJPY"; // default symbol
This is besides setting in the Expert Advisor :
iCustom("USDJPY", 60, ... for this pair!
But if I call this custom indicator for one more pair with other external parameters, it means that for this other pair I must enter a copy of the custom indicator with another name and set the symbol of another pair there too!
But then it really is easier to calculate iMAOnArray inside the Expert Advisor by yourself without any custom indukes!
That's right. Although, it is an amateurish business. My practice, for example, is the use of custom indicators for testing an idea and then transferring the indicator code to the Expert Advisor if the idea proves to be working. This approach virtually guarantees against the pitfalls of "empty" indicator values, which are difficult to detect and can be very annoying if programmed carelessly.
alexjou, I looked at the help and found:
"The extern memory class defines an external variable. The extern modifier is specified before the data type. Extern variables define the input parameters of a program, they are accessible from the program properties window. Arrays cannot act as external variables. "
Here is all code of custom indicator.
As external variables of the EA I set
In the tester, this pair works. What may be the error here?I'll tell you this: I just responded first, others came to see the answer and did not add anything. So do not think that everyone here is so angry and do not want to share knowledge.
alexjou !
Did I understand you correctly??????????
In a multi-currency EA when calling the iCustom indicator for a specific symbol, it is better to provide the following in the indicator itself
extern string SymbolName = "USDJPY"; // default symbol
This is besides setting in the Expert Advisor :
iCustom("USDJPY", 60, ... for this pair!
But if I call this custom indicator for one more pair with other external parameters, it means that for this other pair I must enter a copy of the custom indicator with another name and set the symbol of another pair there too!
But then it really is easier to calculate iMAOnArray inside the Expert Advisor by yourself without any custom indukes!
Thank you for the explanations! I'll get right on it...
klerk, I'm having trouble with my email at the weekends.
Here's my email address for the advisor.
rid200549@ya.ru
klerk, please confirm here or in the mail if you have received my message.
And another question for the experts (sorry if it's too silly):
In multicurrency Expert Advisor -
And in the trailing curves of each pair, do you also have to enter and substitute these values?
or can it be left as it is?And in the trailing pairs, do these values need to be entered and replaced as well?