Люди добрые , пожалуйста ,,прикрутите,, правильно алерт к Stochastic RSI

 

В MQL мне до многих присутствующих далеко . По этому на сочтите за труд, кому не лень добавьте пожалуйста алерт на пересечение уровней 10-90 ( С ВОЗМОЖНОСТЬЮ ИЗМЕНЕНИЯ В НАСТРОЙКАХ )  сформировавшимся и несформировавшимся баром . Статью ,,Звуковые сигналы в индикаторах,, внимательно прочёл но всё же решил обратиться за помощью  к  специалистам  ...

Код не мой, где то в нете нашол уже и не помню где, подправьте пожалуйста если что то неправильно ...


//+------------------------------------------------------------------+
//| Stochastic RSI.mq4 |
//| Copyright © 2004, MetaQuotes Software Corp. |
//| http://www.metaquotes.net/ |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2004, MetaQuotes Software Corp."
#property link "http://www.metaquotes.net/"
//----
#property indicator_separate_window
#property indicator_buffers 2
#property indicator_minimum -5
#property indicator_maximum 105
#property indicator_color1 Chartreuse
#property indicator_color2 Blue

//---- input parameters
extern int RSI_Periods=10;
extern int Percent_K=10;
extern int Percent_D=4;
extern int NumOfBars=0;

//---- buffers
double Buffer1[];
double Buffer2[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,2);
SetIndexBuffer(0,Buffer1);
SetIndexLabel(0,"StochRSI");
SetIndexStyle(1,DRAW_LINE,STYLE_SOLID,1);
SetIndexBuffer(1,Buffer2);
SetIndexLabel(1,"Signal");

//----
return(0);
}
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//---- TODO: add your code here
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int counted_bars=IndicatorCounted();
double Current_RSI,Lowest_RSI,Highest_RSI,sum_K;
//---- TODO: add your code here
if(NumOfBars==0)NumOfBars=Bars;
for(int i=NumOfBars-MathMax(RSI_Periods,Percent_K)-1;i>=0;i--){
Current_RSI=iRSI(NULL,0,RSI_Periods,PRICE_TYPICAL,i);
Highest_RSI=Current_RSI;
Lowest_RSI=Current_RSI;
for(int x=0;x<=Percent_K;x++){
Lowest_RSI=MathMin(Lowest_RSI,iRSI(NULL,0,RSI_Periods,PRICE_TYPICAL,i+x));
Highest_RSI=MathMax(Highest_RSI,iRSI(NULL,0,RSI_Periods,PRICE_TYPICAL,i+x));
}

sum_K=0;
for(x=0;x<=Percent_D;x++) sum_K=sum_K+Buffer1[i+x];

Buffer1[i]=((Current_RSI-Lowest_RSI)/(Highest_RSI-Lowest_RSI))*100;
Buffer2[i]=sum_K/Percent_D;
}
//----
return(0);
}
//+------------------------------------------------------------------+



 
insider >>:

В MQL мне до многих присутствующих далеко . По этому на сочтите за труд, кому не лень добавьте пожалуйста алерт на пересечение уровней 10-90 ( С ВОЗМОЖНОСТЬЮ ИЗМЕНЕНИЯ В НАСТРОЙКАХ ) сформировавшимся и несформировавшимся баром . Статью,,Звуковые сигналы в индикаторах,, внимательно прочёл но всё же решил обратиться за помощью к специалистам ...

Код не мой, где то в нете нашол уже и не помню где, подправьте пожалуйста если что то неправильно ...


//+------------------------------------------------------------------+
//| Stochastic RSI.mq4 |
//| Copyright © 2004, MetaQuotes Software Corp. |
//| http://www.metaquotes.net/ |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2004, MetaQuotes Software Corp."
#property link "http://www.metaquotes.net/"
//----
#property indicator_separate_window
#property indicator_buffers 2
#property indicator_minimum -5
#property indicator_maximum 105
#property indicator_color1 Chartreuse
#property indicator_color2 Blue

//---- input parameters
extern int RSI_Periods=10;
extern int Percent_K=10;
extern int Percent_D=4;
extern int NumOfBars=0;

//---- buffers
double Buffer1[];
double Buffer2[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,2);
SetIndexBuffer(0,Buffer1);
SetIndexLabel(0,"StochRSI");
SetIndexStyle(1,DRAW_LINE,STYLE_SOLID,1);
SetIndexBuffer(1,Buffer2);
SetIndexLabel(1,"Signal");

//----
return(0);
}
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//---- TODO: add your code here
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int counted_bars=IndicatorCounted();
double Current_RSI,Lowest_RSI,Highest_RSI,sum_K;
//---- TODO: add your code here
if(NumOfBars==0)NumOfBars=Bars;
for(int i=NumOfBars-MathMax(RSI_Periods,Percent_K)-1;i>=0;i--){
Current_RSI=iRSI(NULL,0,RSI_Periods,PRICE_TYPICAL,i);
Highest_RSI=Current_RSI;
Lowest_RSI=Current_RSI;
for(int x=0;x<=Percent_K;x++){
Lowest_RSI=MathMin(Lowest_RSI,iRSI(NULL,0,RSI_Periods,PRICE_TYPICAL,i+x));
Highest_RSI=MathMax(Highest_RSI,iRSI(NULL,0,RSI_Periods,PRICE_TYPICAL,i+x));
}

sum_K=0;
for(x=0;x<=Percent_D;x++) sum_K=sum_K+Buffer1[i+x];

Buffer1[i]=((Current_RSI-Lowest_RSI)/(Highest_RSI-Lowest_RSI))*100;
Buffer2[i]=sum_K/Percent_D;
}
//----
return(0);
}
//+------------------------------------------------------------------+



постучи в а-481971287-сю