Navigation´╝ÜHome > Content >

rmo+signals_color_alerts_2.01.mq4

Time: 2018-01-16 | Download file:rmo+signals_color_alerts_2.01.mq4

//+------------------------------------------------------------------+
//|                                                          rmo.mq4 |
//|                                                           mladen |
//| Rahul Mohindar Oscillator                                        |
//| originaly developed by : ????????                                |
//+------------------------------------------------------------------+
#property copyright "copyleft mladen"
#property link      "mladenfx@gmail.com"

#property indicator_separate_window
#property indicator_buffers 5
#property indicator_color1 Green
#property indicator_color2 Red
#property indicator_color3 DimGray
#property indicator_color4 Lime
#property indicator_color5 Gold
#property indicator_width1 2
#property indicator_width2 2
#property indicator_width3 2
#property indicator_style5 STYLE_DOT

//
//
//
//
//

extern int    MALength                   = 2;
extern int    Depth                      = 10;
extern int    SignalsSmooth              = 30;
extern int    Smooth                     = 81;
extern int    Price                      = PRICE_CLOSE;
extern bool   ShowRMO                    = true;
extern bool   ShowSignals                = true;

extern bool   alertsOn                   = true;
extern bool   alertsOnZeroCross          = true;
extern bool   alertsOnSignalCross        = true;
extern bool   alertsOnCurrent            = true;
extern bool   alertsMessage              = true;
extern bool   alertsSound                = true;
extern bool   alertsEmail                = false;

extern bool   ShowArrows                 = true;
extern bool   arrowsOnZeroCross          = true;
extern bool   arrowsOnSignalCross        = true;
extern string arrowsIdentifier           = "rmo arrows1";
extern double arrowsUpperGap             = 0.5;
extern double arrowsLowerGap             = 0.5;
extern color  arrowsOnZeroCrossUpColor   = LimeGreen;
extern color  arrowsOnZeroCrossDnColor   = Red;
extern int    arrowsOnZeroCrossUpCode    = 241;
extern int    arrowsOnZeroCrossDnCode    = 242;
extern color  arrowsOnSignalCrossUpColor = LimeGreen;
extern color  arrowsOnSignalCrossDnColor = Red;
extern int    arrowsOnSignalCrossUpCode  = 159;
extern int    arrowsOnSignalCrossDnCode  = 159;

//
//
//
//
//

#define MAX_depth 30
double  buffer1[];
double  buffer2[];
double  buffer3[];
double  buffer4[];
double  buffer5[];
double  buffer6[];
double  buffer7[];
double  pBuffer[][MAX_depth];

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
//
//
//
//
//

int init()
{
   IndicatorBuffers(7);
      SetIndexBuffer(0,buffer1);
      SetIndexBuffer(1,buffer2);
      SetIndexBuffer(2,buffer3);
      SetIndexBuffer(3,buffer4);
      SetIndexBuffer(4,buffer5);
      SetIndexBuffer(5,buffer6);
      SetIndexBuffer(6,buffer7);
      
      //
      //
      //
      //
      //

      if (!ShowSignals) ShowRMO = true;      
      if (ShowRMO)
      {
         SetIndexStyle(0,DRAW_HISTOGRAM);
         SetIndexStyle(1,DRAW_HISTOGRAM);
         SetIndexStyle(2,DRAW_LINE);
      }
      else
      {
         SetIndexStyle(0,DRAW_NONE);
         SetIndexStyle(1,DRAW_NONE);
         SetIndexStyle(2,DRAW_NONE);
      }
      if (ShowSignals)
      {
         SetIndexStyle(3,DRAW_LINE);
         SetIndexStyle(4,DRAW_LINE);
      }
      else
      {
         SetIndexStyle(3,DRAW_NONE);
         SetIndexStyle(4,DRAW_NONE);
      }
      
      //
      //
      //
      //
      //
      
         MALength = MathMax(MALength,2);
         Depth    = MathMax(MathMin(Depth,MAX_depth),2);
   IndicatorShortName("rmo ("+MALength+","+Depth+","+Smooth+")");
   return(0);
}
int deinit()
{ 
   deleteArrows();  
return(0);
}

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
//
//
//
//
//

double trend[][2];
#define _signal 0
#define _zeroli 1

int start()
{
   double alpha = 2.0/(Smooth+1.0);
   double alphs = 2.0/(SignalsSmooth+1.0);
   int    counted_bars=IndicatorCounted();
   int    i,l,r;


   if(counted_bars<0) return(-1);
   if(counted_bars>0) counted_bars--;
           int limit = MathMin(Bars-counted_bars,Bars-1);
           if (ArrayRange(pBuffer,0) != Bars) ArrayResize(pBuffer,Bars);
           if (ArrayRange(trend,0)!=Bars) ArrayResize(trend,Bars);

   //
   //
   //
   //
   //
   
   for(i=limit, r=Bars-limit-1; i>=0; i--,r++)
   {
      buffer7[i] = iMA(NULL,0,1,0,MODE_SMA,Price,i);
      double high   = buffer7[ArrayMaximum(buffer7,Depth,i)];
      double low    = buffer7[ArrayMinimum(buffer7,Depth,i)];
      double price  = buffer7[i];
      double sum    = 0;
      
      //
      //
      //
      //
      //
      
      for (int k=1; k<=Depth; k++)
      {
         pBuffer[r][k-1] = price;
         if (r>MALength)
         {
            for (l=0, price=0; l0)           trend[r][_zeroli] =  1;
         if (buffer3[i]<0)           trend[r][_zeroli] = -1;
         if (buffer4[i]>buffer5[i])  trend[r][_signal] =  1;
         if (buffer4[i]=0; i--)
   {
      string objectName = ObjectName(i);
         if (StringSubstr(objectName,0,lookForLength) == lookFor) ObjectDelete(objectName);
   }
}

//
//
//
//
//

void deleteArrow(datetime time)
{
   string lookFor = arrowsIdentifier+":"+time; ObjectDelete(lookFor);
}





   

Recommend