Navigation:Home > Content >

RSI-Div-Arrows.mq4

Time: 2015-07-26 | Download file:RSI-Div-Arrows.mq4

//+------------------------------------------------------------------+
//|                                                      RSI-Div.mq4 |
//|                                     Copyright © 2009, Lakshmi Inc|
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2009, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"

#property indicator_chart_window
#property indicator_buffers 6
#property indicator_color1 Blue
#property indicator_color2 Yellow
#property indicator_color3 White
#property indicator_color4 Red
#property indicator_color5 Red
#property indicator_color6 Green
#property indicator_level1 30
#property indicator_level2 70
#property indicator_level3 50
extern int RSI1=5;
extern int RSI2=21;
extern int RSI1MA=5;
extern int RSI2MA=5;

double B1[];
double B2[];
double B3[];
double B4[];
double B5[];
double B6[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0, DRAW_NONE);
   SetIndexStyle(1, DRAW_NONE);
   SetIndexStyle(2, DRAW_NONE);
   SetIndexStyle(3, DRAW_NONE);

   SetIndexStyle(4, DRAW_ARROW);
   SetIndexStyle(5, DRAW_ARROW);
   SetIndexArrow(4,234); 
   SetIndexArrow(5,233); 
   SetIndexEmptyValue(4,0.0);
   SetIndexEmptyValue(5,0.0);
   SetIndexEmptyValue(1,0.0);
   SetIndexEmptyValue(2,0.0);
   SetIndexEmptyValue(3,0.0);
   SetIndexEmptyValue(4,0.0);

   IndicatorDigits(MarketInfo(Symbol(),MODE_DIGITS));
//---- indicator short name
   IndicatorShortName("RSI Div");
//---- indicator buffers mapping
   SetIndexBuffer(0,B1);
   SetIndexBuffer(1,B2);
   SetIndexBuffer(2,B3);
   SetIndexBuffer(3,B4);
   SetIndexBuffer(4,B5);
   SetIndexBuffer(5,B6);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int    counted_bars=IndicatorCounted(), i, limit;
//----
   if(counted_bars>0) counted_bars--;
   limit=Bars-counted_bars;
   for(i=0;iB2[i] && B1[i+1]B2[i+1])
        {
         B6[i]=0;
         B5[i]=(High[i] + (0.001*High[i]));
        }
        else
        {
         B5[i]=0;
         B6[i]=0;
        }
     }
   }
//----
   return(0);
  }
//+------------------------------------------------------------------+

Recommend