Relative Vigor Index MT4
- This topic has 3 replies, 2 voices, and was last updated 4 years ago by .
Viewing 4 posts - 1 through 4 (of 4 total)
Viewing 4 posts - 1 through 4 (of 4 total)
Similar topics:
Forums › ProRealTime English forum › ProBuilder support › Relative Vigor Index MT4
Hi i have been recomended this indicator but cannot find it in PRT or anywhere else for that matter.
I know it is a momentum indicator, but i am not sure how it is calculated I’ll copy the code below but I can only see the code by opening the file with microsoft notepad. i will attach the original file and some screenshots as well. If you could help i would be eternally grateful.
Thankyou.
Notepad Code:
//+——————————————————————+
//| relative-vigor-index.mq4 |
//| ©2011 Best-metatrader-indicators.com. All rights reserved |
//| http://www.best-metatrader-indicators.com |
//+——————————————————————+
#property copyright “Copyright © 2011 Best-metatrader-indicators.com.”
#property link “http://www.best-metatrader-indicators.com”
//—- indicator settings
#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 Green
#property indicator_color2 Red
//—- indicator parameters
extern int ExtRVIPeriod=10;
//—- indicator buffers
double ExtRVIBuffer[];
double ExtRVISignalBuffer[];
string Copyright=”\xA9 http://WWW.BEST-METATRADER-INDICATORS.COM”;
string MPrefix=”FI”;
//+——————————————————————+
//| Custom indicator initialization function |
//+——————————————————————+
int init()
{
//—- indicator buffers mapping
SetIndexBuffer(0,ExtRVIBuffer);
SetIndexBuffer(1,ExtRVISignalBuffer);
//—- indicator line
SetIndexStyle(0,DRAW_LINE);
SetIndexStyle(1,DRAW_LINE);
//—- drawing settings
SetIndexDrawBegin(0,ExtRVIPeriod+3);
SetIndexDrawBegin(1,ExtRVIPeriod+7);
//—- name for DataWindow and indicator subwindow label
IndicatorShortName(“RVI(“+ExtRVIPeriod+”)”);
SetIndexLabel(0,”RVI”);
SetIndexLabel(1,”RVIS”);
//—- initialization done
DL(“001″, Copyright, 5, 20,Gold,”Arial”,10,0);
return(0);
}
//+——————————————————————+
//| Custor indicator deinitialization function |
//+——————————————————————+
int deinit()
{
//—-
ClearObjects();
return(0);
}
//+——————————————————————+
//| Custom indicator iteration function |
//+——————————————————————+
int start()
{
int i,j,nLimit,nCountedBars;
double dValueUp,dValueDown,dNum,dDeNum;
//—-
if(Bars<=ExtRVIPeriod+8) return(0);
//—-
nCountedBars=IndicatorCounted();
//—- check for possible errors
if(nCountedBars<0) return(-1);
//—- last counted bar will be recounted
nLimit=Bars-ExtRVIPeriod-4;
if(nCountedBars>ExtRVIPeriod+4)
nLimit=Bars-nCountedBars;
//—- RVI counted in the 1-st buffer
for(i=0; i<=nLimit; i++)
{
dNum=0.0;
dDeNum=0.0;
for(j=i; j<i+ExtRVIPeriod; j++)
{
dValueUp=((Close[j]-Open[j])+2*(Close[j+1]-Open[j+1])+2*(Close[j+2]-Open[j+2])+(Close[j+3]-Open[j+3]))/6;
dValueDown=((High[j]-Low[j])+2*(High[j+1]-Low[j+1])+2*(High[j+2]-Low[j+2])+(High[j+3]-Low[j+3]))/6;
dNum+=dValueUp;
dDeNum+=dValueDown;
}
if(dDeNum!=0.0)
ExtRVIBuffer[i]=dNum/dDeNum;
else
ExtRVIBuffer[i]=dNum;
}
//—- signal line counted in the 2-nd buffer
nLimit=Bars-ExtRVIPeriod-7;
if(nCountedBars>ExtRVIPeriod+8)
nLimit=Bars-nCountedBars+1;
for(i=0; i<=nLimit; i++)
ExtRVISignalBuffer[i]=(ExtRVIBuffer[i]+2*ExtRVIBuffer[i+1]+2*ExtRVIBuffer[i+2]+ExtRVIBuffer[i+3])/6;
//—-
return(0);
}
//+——————————————————————+
//| DL function |
//+——————————————————————+
void DL(string label, string text, int x, int y, color clr, string FontName = “Arial”,int FontSize = 12, int typeCorner = 1)
{
string labelIndicator = MPrefix + label;
if (ObjectFind(labelIndicator) == -1)
{
ObjectCreate(labelIndicator, OBJ_LABEL, 0, 0, 0);
}
ObjectSet(labelIndicator, OBJPROP_CORNER, typeCorner);
ObjectSet(labelIndicator, OBJPROP_XDISTANCE, x);
ObjectSet(labelIndicator, OBJPROP_YDISTANCE, y);
ObjectSetText(labelIndicator, text, FontSize, FontName, clr);
}
//+——————————————————————+
//| ClearObjects function |
//+——————————————————————+
void ClearObjects()
{
for(int i=0;i<ObjectsTotal();i++)
if(StringFind(ObjectName(i),MPrefix)==0) { ObjectDelete(ObjectName(i)); i–; }
}
//+——————————————————————+
Im just trying to upload the attachments.
RVI code is here: https://www.prorealcode.com/topic/rvi-relative-vigor-index/#post-41266
Nicolas…you are a diamond!! thankyou!!
Find exclusive trading pro-tools on