3c_JRSX_Hs range_Alerts_v1





//+SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS+
//|                                                   3c_JRSX_Hs.mq4 |
//|          JRSX: Copyright © 2005,            Weld, Jurik Research | 
//|                                          http://weld.torguem.net | 
//|   MQL4+3color: Copyright © 2005,                Nikolay Kositsin | 
//|                                   Khabarovsk, violet@mail.kht.ru |   
//+SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS+
#property copyright "Copyright © 2005, Weld, Jurik Research"
#property link      " http://weld.torguem.net"


#property indicator_separate_window
#property indicator_buffers  4
#property indicator_color1  Blue
#property indicator_color2  Magenta
#property indicator_color3  Gray
#property indicator_color4  DeepSkyBlue
#property indicator_level1  0.86
#property indicator_level2 -0.86
#property indicator_level3  0.5
#property indicator_level4  -0.5
#property indicator_level5  0.62
#property indicator_level6  -0.62
#property indicator_level7  0.78
#property indicator_level8  -0.78
#property indicator_maximum  1.25
#property indicator_minimum -1.25
//---- input parameters
extern int  JRSX.Length = 8;
extern int  Sign.Length = 15;
extern int  Sign.Phase  = 100;
extern int   CountBars  = 3000;

extern bool SendAlert = true;


extern double JRSXBarSellSignal = 0.5;
extern double JRSXLineSellSignal = 0.5;
extern double JRSXBarBuySignal = -0.5;
extern double JRSXLineBuySignal = -0.5;

datetime lasttime = 0; 

//---- buffers
double JRSX1[];
double JRSX2[];
double JRSX3[];
double JSIGN[];
//----
int    shift,r,w,k,counted_bars,T0,T1,Tnew;
//----
double v4,v8,v10,v14,v18,v20,v0C,v1C,v8A,trend;   
double F28,F30,F38,F40,F48,F50,F58,F60,F68,F70,F78,F80,JRSX; 
double f0,f28,f30,f38,f40,f48,f50,f58,f60,f68,f70,f78,f80,Kg,Hg;
//+SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS+
//| Custom indicator initialization function                         |
//+SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS+
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_HISTOGRAM, STYLE_SOLID);
   SetIndexStyle(1,DRAW_HISTOGRAM, STYLE_SOLID);
   SetIndexStyle(2,DRAW_HISTOGRAM, STYLE_SOLID);
   SetIndexStyle(3,DRAW_LINE, STYLE_DOT);
//----   
   SetIndexBuffer(0,JRSX1);
   SetIndexBuffer(1,JRSX2);
   SetIndexBuffer(2,JRSX3);
   SetIndexBuffer(3,JSIGN);   
//----  
   IndicatorShortName("JRSX");
//----   
   SetIndexDrawBegin(0,Bars-CountBars);
   SetIndexDrawBegin(1,Bars-CountBars);
   SetIndexDrawBegin(2,Bars-CountBars);
   SetIndexDrawBegin(3,Bars-CountBars);
   IndicatorDigits(MarketInfo(Symbol(),MODE_DIGITS));
//----  
   if (JRSX.Length-1>=5) w=JRSX.Length-1; else w=5; Kg=3/(JRSX.Length+2.0); Hg=1.0-Kg;
//----
return(0);
  }
  
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//---- TODO: add your code here
/*

ALARM CODE PLACEMENT ONE!!!!!!!!!!

if (SendAlert == true)
{	 
if (lasttime != Time[0])
{
if ((JRSX1[shift] >= JRSXBarSellSignal && JSIGN[shift] >= JRSXLineSellSignal) || (JRSX3[shift] >= JRSXBarSellSignal && JSIGN[shift] >= JRSXLineSellSignal))
   {

      Alert("JRSX_v1 Major Sell Signal on ", Symbol(), ": Blue: ", JRSX1[shift], " Grey: ", JRSX3[shift], " Line: ", JSIGN[shift]);
   SendMail("JRSX_v1 Major Sell Signal -> "+ Symbol(), " Blue: "+ JRSX1[shift]+ " Grey: "+ JRSX3[shift]+ " Line: "+ JSIGN[shift]);
   PlaySound("alert2.wav");
   lasttime = Time[0];
   
      if ((JRSX2[shift] <= JRSXBarBuySignal && JSIGN[shift] <= JRSXLineBuySignal) || (JRSX3[shift] <= JRSXBarBuySignal && JSIGN[shift] <= JRSXLineBuySignal))
       {
      
      Alert("JRSX_v1 Major Buy Signal on ", Symbol(), ": Magenta: ", JRSX2[shift], " Grey: ", JRSX3[shift], " Line: ", JSIGN[shift]);
   SendMail("JRSX_v1 Major Buy Signal -> "+ Symbol(), " Magenta: "+ JRSX2[shift]+ " Grey: "+ JRSX3[shift]+ " Line: "+ JSIGN[shift]);
   PlaySound("alert2.wav");
   lasttime = Time[0];
       
      }
     }
     
if ((JRSX1[shift] >= JRSXBarSellSignal) || (JRSX3[shift] >= JRSXBarSellSignal))
   {

       Alert("JRSX_v1 Minor Sell Signal on ",Symbol(), ": Blue: ", JRSX1[shift], " Grey: ", JRSX3[shift], " Line: ", JSIGN[shift]);
    SendMail("JRSX_v1 Minor Sell Signal -> "+ Symbol(), " Blue: "+ JRSX1[shift]+ " Grey: "+ JRSX3[shift]+ " Line: "+ JSIGN[shift]);
    PlaySound("alert2.wav");
    lasttime = Time[0];
   
      if ((JRSX2[shift] <= JRSXBarBuySignal) || (JRSX3[shift] <= JRSXBarBuySignal))
       {
      
       Alert("JRSX_v1 Minor Buy Signal on ",Symbol(), ": Magenta: ", JRSX2[shift], " Grey: ", JRSX3[shift], " Line: ", JSIGN[shift]);
    SendMail("JRSX_v1 Minor Buy Signal -> "+ Symbol(), " Magenta: "+ JRSX2[shift]+ " Grey: "+ JRSX3[shift]+ " Line: "+ JSIGN[shift]);
    PlaySound("alert2.wav");
    lasttime = Time[0];
       
      }
     }
    }
    }


*/
   
//----
   return(0);
  }
  
 
  
//+SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS+
//| Custom indicator iteration function                              |
//+SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS+
int start()
{
counted_bars=IndicatorCounted();
if (counted_bars<0) return(-1);
if (counted_bars>JRSX.Length) shift=Bars-counted_bars-1;
else shift=Bars-JRSX.Length-1;
int limit=shift;
//----+ Ââåäåíèå è èíèöèàëèçàöèÿ âíóòðåííèõ ïåðåìåííûõ ôóíêöèè JJMASeries, nJMAnumber=1(Îäíî îáðàùåííèå ê ôóíêöèè) 
if (limit==Bars-JRSX.Length-1){int reset=-1;int set=JJMASeries(1,0,0,0,0,0,0,0,reset);if((reset!=0)||(set!=0))return(-1);}

Tnew=Time[shift+1];

//+--- âîññòàíîâëåíèå ïåðåìåííûõ +=====================+
if((Tnew!=T0)&&(shift<Bars-JRSX.Length-1)) 
{
if (Tnew==T1)
{
f28=F28; f30=F30; f38=F38; f40=F40; f48=F48; f50=F50;
f58=F58; f60=F60; f68=F68; f70=F70; f78=F78; f80=F80;
} else return(-1);
}
//+--- +===============================================+

if (JRSX.Length-1>=5)w=JRSX.Length-1;else w=5; Kg=3/(JRSX.Length+2.0); Hg=1.0-Kg;

while (shift>=0)
{
//+-------------------+
if (r==0){r=1; k=0;}
else
{
//++++++++++++++++++++
if (r>=w) r=w+1; else r=r+1;

v8 = Close[shift]-Close[shift+1]; v8A=MathAbs(v8);
//---- âû÷èñëåíèå V14 ------
f28 = Hg  * f28 + Kg  *  v8;
f30 = Kg  * f28 + Hg  * f30;
v0C = 1.5 * f28 - 0.5 * f30;
f38 = Hg  * f38 + Kg  * v0C;
f40 = Kg  * f38 + Hg  * f40;
v10 = 1.5 * f38 - 0.5 * f40;
f48 = Hg  * f48 + Kg  * v10;
f50 = Kg  * f48 + Hg  * f50;
v14 = 1.5 * f48 - 0.5 * f50;
//---- âû÷èñëåíèå V20 ------
f58 = Hg  * f58 + Kg  * v8A;
f60 = Kg  * f58 + Hg  * f60;
v18 = 1.5 * f58 - 0.5 * f60;
f68 = Hg  * f68 + Kg  * v18;
f70 = Kg  * f68 + Hg  * f70;
v1C = 1.5 * f68 - 0.5 * f70;
f78 = Hg  * f78 + Kg  * v1C;
f80 = Kg  * f78 + Hg  * f80;
v20 = 1.5 * f78 - 0.5 * f80;
//-------wwwwwwwwww---------
if ((r <= w) && (v8!= 0)) k = 1;
if ((r == w) && (k == 0)) r = 0;
}//++++++++++++++++++++
if ((r>w)&&(v20>0.0000000001)){v4=(v14/v20+1.0)*50.0;if(v4>100.0)v4=100.0;if(v4<0.0)v4=0.0;}else v4=50.0;

JRSX=(v4/50)-1;

//+--- Ñîõðàíåíèå ïåðåìåííûõ +========================+
if (shift==1)
{
T1=Time[1];T0=Time[0];
F28=f28; F30=f30; F38=f38; F40=f40; F48=f48; F50=f50;
F58=f58; F60=f60; F68=f68; F70=f70; F78=f78; F80=f80;
}
//+---+===============================================+

//---- +SSSSSSSSSSSSSSSS <<< Three colore code >>> SSSSSSSSSSSSSSSSSSSSSSSSS+
trend=JRSX-JRSX1[shift+1]-JRSX2[shift+1]-JRSX3[shift+1];     
if(trend>0.0)     {JRSX1[shift]=JRSX;JRSX2[shift]=0.0; JRSX3[shift]=0.0;}
else{if(trend<0.0){JRSX1[shift]=0.0; JRSX2[shift]=JRSX;JRSX3[shift]=0.0;}
else              {JRSX1[shift]=0.0; JRSX2[shift]=0.0; JRSX3[shift]=JRSX;}}    
//---- +SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS+ 

/*

ALARM CODE PLACEMENT TWO!!!!!!!!!!

if (SendAlert == true)
{	 
if (lasttime != Time[0])
{
if ((JRSX1[shift] >= JRSXBarSellSignal && JSIGN[shift] >= JRSXLineSellSignal) || (JRSX3[shift] >= JRSXBarSellSignal && JSIGN[shift] >= JRSXLineSellSignal))
   {

      Alert("JRSX_v1 Major Sell Signal on ", Symbol(), ": Blue: ", JRSX1[shift], " Grey: ", JRSX3[shift], " Line: ", JSIGN[shift]);
   SendMail("JRSX_v1 Major Sell Signal -> "+ Symbol(), " Blue: "+ JRSX1[shift]+ " Grey: "+ JRSX3[shift]+ " Line: "+ JSIGN[shift]);
   PlaySound("alert2.wav");
   lasttime = Time[0];
   
      if ((JRSX2[shift] <= JRSXBarBuySignal && JSIGN[shift] <= JRSXLineBuySignal) || (JRSX3[shift] <= JRSXBarBuySignal && JSIGN[shift] <= JRSXLineBuySignal))
       {
      
      Alert("JRSX_v1 Major Buy Signal on ", Symbol(), ": Magenta: ", JRSX2[shift], " Grey: ", JRSX3[shift], " Line: ", JSIGN[shift]);
   SendMail("JRSX_v1 Major Buy Signal -> "+ Symbol(), " Magenta: "+ JRSX2[shift]+ " Grey: "+ JRSX3[shift]+ " Line: "+ JSIGN[shift]);
   PlaySound("alert2.wav");
   lasttime = Time[0];
       
      }
     }
     
if ((JRSX1[shift] >= JRSXBarSellSignal) || (JRSX3[shift] >= JRSXBarSellSignal))
   {

       Alert("JRSX_v1 Minor Sell Signal on ",Symbol(), ": Blue: ", JRSX1[shift], " Grey: ", JRSX3[shift], " Line: ", JSIGN[shift]);
    SendMail("JRSX_v1 Minor Sell Signal -> "+ Symbol(), " Blue: "+ JRSX1[shift]+ " Grey: "+ JRSX3[shift]+ " Line: "+ JSIGN[shift]);
    PlaySound("alert2.wav");
    lasttime = Time[0];
   
      if ((JRSX2[shift] <= JRSXBarBuySignal) || (JRSX3[shift] <= JRSXBarBuySignal))
       {
      
       Alert("JRSX_v1 Minor Buy Signal on ",Symbol(), ": Magenta: ", JRSX2[shift], " Grey: ", JRSX3[shift], " Line: ", JSIGN[shift]);
    SendMail("JRSX_v1 Minor Buy Signal -> "+ Symbol(), " Magenta: "+ JRSX2[shift]+ " Grey: "+ JRSX3[shift]+ " Line: "+ JSIGN[shift]);
    PlaySound("alert2.wav");
    lasttime = Time[0];
       
      }
     }
    }
    }
*/

//----+ Âû÷èñëåíèå ñèãíàëüíîé ëèíèè ( Îáðàùåíèå ê ôóíêöèè JJMASeries çà íîìåðîì 0, ïàðàìåòðû nJMAPhase è nJMALength íå ìåíÿþòñÿ íà êàæäîì áàðå (nJMAdin=0))
reset=1;JSIGN[shift]=JJMASeries(0,0,Bars-JRSX.Length-1,limit,Sign.Phase,Sign.Length,JRSX,shift,reset);if(reset!=0)return(-1);

shift--;
}
//+-------------------+
/*

ALARM CODE PLACEMENT THREE!!!!!!!!!!

if (SendAlert == true)
{	 
if (lasttime != Time[0])
{
if ((JRSX1[shift] >= JRSXBarSellSignal && JSIGN[shift] >= JRSXLineSellSignal) || (JRSX3[shift] >= JRSXBarSellSignal && JSIGN[shift] >= JRSXLineSellSignal))
   {

      Alert("JRSX_v1 Major Sell Signal on ", Symbol(), ": Blue: ", JRSX1[shift], " Grey: ", JRSX3[shift], " Line: ", JSIGN[shift]);
   SendMail("JRSX_v1 Major Sell Signal -> "+ Symbol(), " Blue: "+ JRSX1[shift]+ " Grey: "+ JRSX3[shift]+ " Line: "+ JSIGN[shift]);
   PlaySound("alert2.wav");
   lasttime = Time[0];
   
      if ((JRSX2[shift] <= JRSXBarBuySignal && JSIGN[shift] <= JRSXLineBuySignal) || (JRSX3[shift] <= JRSXBarBuySignal && JSIGN[shift] <= JRSXLineBuySignal))
       {
      
      Alert("JRSX_v1 Major Buy Signal on ", Symbol(), ": Magenta: ", JRSX2[shift], " Grey: ", JRSX3[shift], " Line: ", JSIGN[shift]);
   SendMail("JRSX_v1 Major Buy Signal -> "+ Symbol(), " Magenta: "+ JRSX2[shift]+ " Grey: "+ JRSX3[shift]+ " Line: "+ JSIGN[shift]);
   PlaySound("alert2.wav");
   lasttime = Time[0];
       
      }
     }
     
if ((JRSX1[shift] >= JRSXBarSellSignal) || (JRSX3[shift] >= JRSXBarSellSignal))
   {

       Alert("JRSX_v1 Minor Sell Signal on ",Symbol(), ": Blue: ", JRSX1[shift], " Grey: ", JRSX3[shift], " Line: ", JSIGN[shift]);
    SendMail("JRSX_v1 Minor Sell Signal -> "+ Symbol(), " Blue: "+ JRSX1[shift]+ " Grey: "+ JRSX3[shift]+ " Line: "+ JSIGN[shift]);
    PlaySound("alert2.wav");
    lasttime = Time[0];
   
      if ((JRSX2[shift] <= JRSXBarBuySignal) || (JRSX3[shift] <= JRSXBarBuySignal))
       {
      
       Alert("JRSX_v1 Minor Buy Signal on ",Symbol(), ": Magenta: ", JRSX2[shift], " Grey: ", JRSX3[shift], " Line: ", JSIGN[shift]);
    SendMail("JRSX_v1 Minor Buy Signal -> "+ Symbol(), " Magenta: "+ JRSX2[shift]+ " Grey: "+ JRSX3[shift]+ " Line: "+ JSIGN[shift]);
    PlaySound("alert2.wav");
    lasttime = Time[0];
       
      }
     }
    }
    }
*/

return(0);
}
//----+ Ââåäåíèå ôóíêöèè JJMASeries (ôàéë JJMASeries.mqh ñëåäóåò ïîëîæèòü â ïàïêó (äèðåêòîðèþ): MetaTrader\experts\include)
#include <JJMASeries.mqh> 










Sample





Analysis



Market Information Used:

Series array that contains open time of each bar
Series array that contains close prices for each bar


Indicator Curves created:

Implements a curve of type DRAW_HISTOGRAM
Implements a curve of type DRAW_LINE


Indicators Used:



Custom Indicators Used:

Order Management characteristics:

Other Features:

It issuies visual alerts to the screen
It sends emails
It plays sound alerts