Velocity_v2 Indicator For MT5
The Velocity_v2 Indicator For MT5 is one of the most advanced momentum indicators that work based on the triple averaging method. When you spot the histogram bars on the negative side of the reference line you can expect a downtrend. On the contrary, if the histogram bars are formed on the positive side of the reference line, you can expect an uptrend. Pay special attention to the purple color signal curve since it allows you to find the overbought and oversold region. If the histogram bars trades above the purple color signal line on the positive side of the reference line, the market is in the overbought region. Similarly, if the histogram bars trades below the purple color line on the negative side of the reference line the market is in the oversold region. Based on the state of the market, you should place your trade with a low-risk profile so that you can embrace a few losing trades while using the reading of this indicator.
Installing the Velocity_v2 Indicator For MT5
After you downloaded the indicator via the form above you need to unzip the zip-file. Then you need to copy the file velocity_v2.mq5 into the folder MQL5\Indicators of your MT5 installation. After that please restart MT5 and then you will be able to see the indicator in the list of indicators.
Parameters of the Velocity_v2 Indicator For MT5
The Velocity_v2 Indicator For MT5 has 9 parameters to configure.
input uint MomPeriod=1; //period of Momentum
input Smooth_Method VelocityMethod=MODE_EMA; //the method of fast averaging
input uint VelocityLength=8; //the depth of fast averaging
input int VelocityPhase=15; //the parameter of fast averaging
input Smooth_Method SignMethod=MODE_EMA; //Smoothing method
input uint SignLength=5; //Smoothing depth
input int SignPhase=15; //Smoothing parameter,
input Applied_price_ IPC=PRICE_CLOSE;//price constant
input int Shift=0; // horizontal shift of the indicator in bars
Buffers of the Velocity_v2 Indicator For MT5
The Velocity_v2 Indicator For MT5 provides 2 buffers.
SetIndexBuffer(0,VelBuffer,INDICATOR_DATA);
SetIndexBuffer(1,SignBuffer,INDICATOR_DATA);
Main Parts Of The Code
int OnCalculate(
const int rates_total, // amount of history in bars at the current tick
const int prev_calculated,// amount of history in bars at the previous tick
const datetime &time[],
const double &open[],
const double& high[], // price array of maximums of price for the calculation of indicator
const double& low[], // price array of price lows for the indicator calculation
const double &close[],
const long &tick_volume[],
const long &volume[],
const int &spread[]
)
{
//---- checking the number of bars to be enough for calculation
if(rates_total lt min_rates_total) return(0);
//---- declaration of local variables
int first;
//---- Calculation of the starting number first for the cycle of recalculation of bars
if(prev_calculated gt rates_total || prev_calculated lt =0) // checking for the first start of the indicator calculation
{
first=0; // starting number for calculation of all bars
}
else first=prev_calculated-1; // Starting index for the calculation of new bars
//---- main cycle of calculation of the indicator
for(int bar=first; bar lt rates_total && !IsStopped(); bar++)
{
double price=PriceSeries(IPC,bar,open,low,high,close);
double mom=Mom.MomentumSeries(0,prev_calculated,rates_total,MomPeriod,price,bar,false);
double xmom=XMA1.XMASeries(min_rates_1,prev_calculated,rates_total,VelocityMethod,VelocityPhase,VelocityLength,mom,bar,false);
double xxmom=XMA2.XMASeries(min_rates_2,prev_calculated,rates_total,VelocityMethod,VelocityPhase,VelocityLength,xmom,bar,false);
double xxxmom=XMA3.XMASeries(min_rates_3,prev_calculated,rates_total,VelocityMethod,VelocityPhase,VelocityLength,xxmom,bar,false);
VelBuffer[bar]=xxxmom;
SignBuffer[bar]=XMA4.XMASeries(min_rates_4,prev_calculated,rates_total,SignMethod,SignPhase,SignLength,xxxmom,bar,false);
}
//----
return(rates_total);
}
//+------------------------------------------------------------------+