Параметры для Moving Average - страница 2

 
leonid553 писал(а) >>

Вот обнаружился в заначке! Надеюсь, этот индикатор вам подойдет! Задаете в свойствах название пары. И на графике открытого инструмента(напр. EURUSD) встанет МА той пары, кот. вы набрали( напр. EURJPY, GBPJPY ...)

Удачи !

Благодарю Вас!!!

 

Те, кто понимает в код, помогите

Не срабатывает параметр Symb1

//+------------------------------------------------------------------+
//| Moving Averege for Symbols.mq4 |
//| Copyright © 2008 |
//| http://www.**********.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2008"
#property link "http://www.**********.net"

#property indicator_level1 0.0
#property indicator_levelcolor Silver
#property indicator_levelwidth 0
#property indicator_levelstyle STYLE_DASH

#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 Red
//---- input parameters
extern int MA_Period=7;
extern int MA_Shift=0;
extern string Symb1="GBPJPY";
extern double Price_multiply1 =1.0;
extern double Price_plus1 = 0.0;
//---- buffers
double ExtMapBuffer1[];
//----
int MA_Method=0;
int ExtCountedBars=0;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(0,ExtMapBuffer1);
int draw_begin;
string short_name;
//---- drawing settings
SetIndexStyle(0,DRAW_LINE);
SetIndexShift(0,MA_Shift);
IndicatorDigits(MarketInfo(Symb1,MODE_DIGITS));
if(MA_Period<2) MA_Period=13;
draw_begin=MA_Period-1;
//---- indicator short name
switch(MA_Method)
{
case 1 : short_name="SMA(";
}
IndicatorShortName(short_name+MA_Period+")");
SetIndexDrawBegin(0,draw_begin);
//---- indicator buffers mapping
SetIndexBuffer(0,ExtMapBuffer1);
//---- initialization done
return(0);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int start()
{
if(Bars<=MA_Period) return(0);
ExtCountedBars=IndicatorCounted();
//---- check for possible errors
if (ExtCountedBars<0) return(-1);
//---- last counted bar will be recounted
if (ExtCountedBars>0) ExtCountedBars--;
//----
switch(MA_Method)
{
case 0 : sma(); break;
}
//---- done
return(0);
}
//+------------------------------------------------------------------+
//| Simple Moving Average |
//+------------------------------------------------------------------+
void sma()
{
double sum=0;
int i,pos=Bars-ExtCountedBars-1;
//---- initial accumulation
if(pos<MA_Period) pos=MA_Period;
for(i=1;i<MA_Period;i++,pos--)
sum+=Close[pos]*Price_multiply1+Price_plus1;
//---- main calculation loop
while(pos>=0)
{
sum+=Close[pos]*Price_multiply1+Price_plus1;
ExtMapBuffer1[pos]=sum/MA_Period;
sum-=Close[pos+MA_Period-1]*Price_multiply1+Price_plus1;
pos--;
}
return(0);
}

МА должна быть по заданной паре, а показывает пару текущего окна.

Я не знаю, как привязать к параметру "extern string Symb1="GBPJPY";"

Помогите кто может

 
Всем спасибо, разобрался