Special RSI ARROW_001

Special RSI ARROW_001
Indicators Used
Relative strength indexMoving average indicator
Miscellaneous
Implements a curve of type %1
0 Views
0 Downloads
0 Favorites
Special RSI ARROW_001
//+------------------------------------------------------------------+
//|                                            Special_RSI_ARROW.mq4 |
//|                                          Copyright © 2009, leMai |
//+------------------------------------------------------------------+
#property  copyright "Copyright © 2009, leMai"
//----
#property  indicator_separate_window
#property  indicator_buffers 5
#property  indicator_color1  Green
#property  indicator_color2  White
#property  indicator_color3  Blue
#property  indicator_color4  LimeGreen
#property  indicator_color5  Red
//----
extern int RSIPeriod1=14;
extern int RSIPeriod2=28;
extern int Cross1=10;
extern double difference=2.0;

double   ind_buffer1[];
double   MABuffer1[];
double   Cross[];
double   UpArrow[];
double   DnArrow[];

double now=1,last=0;
int direction=0;
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int init()
  {
   SetIndexStyle(0, DRAW_LINE, STYLE_SOLID, 2);
   SetIndexStyle(1, DRAW_LINE, STYLE_SOLID, 2);
   SetIndexStyle(2, DRAW_LINE, STYLE_SOLID, 2);
   SetIndexStyle(3, DRAW_ARROW);
   SetIndexArrow(3, 233);
   SetIndexStyle(4, DRAW_ARROW);
   SetIndexArrow(4, 234);
//----   
   SetIndexBuffer(0, ind_buffer1);
   SetIndexBuffer(1, MABuffer1);
   SetIndexBuffer(2, Cross);
   SetIndexBuffer(3, UpArrow);
   SetIndexBuffer(4, DnArrow);
//----   
   IndicatorShortName("Special RSI ARROW");
   Comment("leMai");
   return(0);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int start()
  {
   double RSI1,RSI2;

   int  Limit, i, counted_bars = IndicatorCounted();
//----
   if(counted_bars < 0) 
       return(-1);
//----
   if(counted_bars > 0) 
       counted_bars--;
   Limit=ArraySize(MABuffer1);
   for(i=Limit; i>=0; i--) 
   {
     RSI1 = iRSI(NULL, 0, RSIPeriod1, PRICE_CLOSE, i);
     RSI2 = iRSI(NULL, 0, RSIPeriod2, PRICE_CLOSE, i);

     MABuffer1[i] = (RSI1-RSI2);
     
   }
   
   
      
   for(i=Limit; i>=0; i--)
   {
     ind_buffer1[i] = iMAOnArray(MABuffer1,0,14,0,MODE_EMA,i);   
   }    
   
   for(i=Limit; i>=0; i--)
     {
      Cross[i]=iMAOnArray(ind_buffer1,Bars,Cross1,0,MODE_EMA,i);
      now=Cross[i];
     
    
      if(now>(last+(difference/1000)))
      {
        if(direction<1)
        {
         UpArrow[i]=Cross[i];
         direction=1;
        } 
      }
        else  
          if(now<(last-(difference/1000)))
          {
            if(direction>-1)
            {
             DnArrow[i]=Cross[i];
             direction=-1;
            }        
          } 
         
      last=Cross[i];
     } 
   
   for(i=Limit; i>=0; i--)
      {
        MABuffer1[i]=0;
      }
   
   
   return(0);
}
//+------------------------------------------------------------------+


Comments

Markdown supported. Formatting help

Markdown Formatting Guide

Element Markdown Syntax
Heading # H1
## H2
### H3
Bold **bold text**
Italic *italicized text*
Link [title](https://www.example.com)
Image ![alt text](image.jpg)
Code `code`
Code Block ```
code block
```
Quote > blockquote
Unordered List - Item 1
- Item 2
Ordered List 1. First item
2. Second item
Horizontal Rule ---