Author: 2009. Alexei Parvatkin. Togliatti
Indicators Used
Relative strength indexMoving average indicator
Miscellaneous
Implements a curve of type %1
0 Views
0 Downloads
0 Favorites
MA_RSI_v1
//+------------------------------------------------------------------+
//|                                                       MA_RSI.mq4 |
//|                                                  Alexei Parvatkin|
//|                                                  alexpar@list.ru |
//+------------------------------------------------------------------+
#property copyright "2009. Alexei Parvatkin. Togliatti"
#property link      "e-mail: alexpar@list.ru"

#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 Gold
#property indicator_level1 50
#property indicator_level2 90
#property indicator_level3 10
#property indicator_level4 45
#property indicator_level5 55
#property indicator_maximum 100
#property indicator_minimum 0
//---- input parameters

extern int RSI_Period=5;
extern int RSI_Mode=0;
extern int  MA_Period=5;
extern int  MA_Mode  =0;
extern int Limit=5440;

double RSI[];
double MA[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init() 
  {
   IndicatorBuffers(2);
   SetIndexStyle(0,DRAW_LINE);
   SetIndexDrawBegin(0,RSI_Period+MA_Period);
   SetIndexBuffer(0,MA);
   SetIndexBuffer(1,RSI);
   IndicatorShortName("MA_RSI("+RSI_Period+","+MA_Period+")");
   SetIndexLabel(0,"MA(WPR)");

   return(0); 
  }
//+------------------------------------------------------------------+
int start() 
  {
   int i;
   int counted_bars=IndicatorCounted();
   if(counted_bars<0) return(-1);
   if(counted_bars>0) counted_bars--;
   int limit=Bars-counted_bars;
   if(counted_bars==0) limit--;

   if(limit>Limit && Limit>0) limit=Limit;
   for(i = limit;i>=0;i--) RSI[i] = iRSI(Symbol(),Period(),RSI_Period,RSI_Mode,i);
   for(i = limit;i>=0;i--) MA[i] = iMAOnArray(RSI,0,MA_Period,0,MA_Mode,i);
   return(0);
  }// int start()

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 ---