VininI_RSI_FO_v1

Author: Copyright � 2008, Victor Nicolaev
Indicators Used
Relative strength indexMoving average indicator
Miscellaneous
Implements a curve of type %1
0 Views
0 Downloads
0 Favorites
VininI_RSI_FO_v1
//+------------------------------------------------------------------+
//|                                                     VininI_Cyber |
//|                                Copyright © 2009, Victor Nicolaev |
//|                                            e-mail: vinin@mail.ru |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2008, Victor Nicolaev"
#property link      "e-mail: vinin@mail.ru"

#property indicator_separate_window
#property indicator_buffers 3
#property indicator_color1 Yellow
#property indicator_color2 Lime
#property indicator_color3 Red
#property indicator_level1  -0.5
#property indicator_level2   0
#property indicator_level3   0.5
#property indicator_minimum -1.05
#property indicator_maximum  1.05

//---- input parameters 

extern int  RSI_Period=5;
extern int  RSI_Price =0;
extern int  MA_Period =9;
extern int  MA_Method =3;
//---- buffers 

double Value[];
double MA[];
double iFish[];
double Buy[];
double Sell[];
//+------------------------------------------------------------------+ 
//| Custom indicator initialization function | 
//+------------------------------------------------------------------+ 
int init() 
  {
   IndicatorBuffers(5);
   SetIndexBuffer(0,iFish);
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(1,Buy);
   SetIndexStyle(1,DRAW_LINE);
   SetIndexBuffer(2,Sell);
   SetIndexStyle(2,DRAW_LINE);

   SetIndexBuffer(3,Value);
   SetIndexBuffer(4,MA);


   return(0);
  }

int deinit() { return(0); }
//+------------------------------------------------------------------+ 
//| Custom indicator iteration function | 
//+------------------------------------------------------------------+ 
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-=2;

   for(i = limit; i >= 0; i--)    Value[i]=0.1*(iRSI(NULL,0,RSI_Period,RSI_Price,i)-50.0);
   for(i = limit; i >= 0; i--)    MA[i]=iMAOnArray(Value,0,MA_Period,0,MA_Method,i);
   for(i=limit; i>=0; i--) 
     {
      iFish[i]=(MathExp(2.0*MA[i])-1.0)/(MathExp(2.0*MA[i])+1.0);
      if(iFish[i]> 0.5) {Buy[i] =iFish[i]; Buy[i+1] =iFish[i+1];}
      if(iFish[i]<-0.5) {Sell[i]=iFish[i]; Sell[i+1]=iFish[i+1];}
     }
   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 ---