Professional Documents
Culture Documents
//| VolumeX.mq5 |
//| Copyright 2019, Phillipe S. Scofield |
//| https://mlatstudent.blogspot.com/ |
//+------------------------------------------------------------------+
#property copyright "Copyright 2019, Phillipe S. Scofield"
#property link "https://mlatstudent.blogspot.com/"
#property version "1.00"
#property description "Modificação do indicador padrão de volume com uma média
móvel incorporada"
#property indicator_separate_window
#property indicator_buffers 2
#property indicator_plots 2
#property indicator_minimum 0.0
//+--------------------------------------------+
//| Volume Indicator drawing parameters |
//+--------------------------------------------+
#property indicator_type1 DRAW_HISTOGRAM
#property indicator_color1 Blue
//#property indicator_style1 STYLE_SOLID
#property indicator_width1 4
#property indicator_label1 "Volume"
//+--------------------------------------+
//| MA Indicator drawing parameters |
//+--------------------------------------+
#property indicator_type2 DRAW_LINE
#property indicator_color2 Red
#property indicator_style2 STYLE_SOLID
#property indicator_width2 2
#property indicator_label2 "Média"
//+----------------------------------------------+
//| Indicator input parameters |
//+----------------------------------------------+
input ENUM_APPLIED_VOLUME volumeType=VOLUME_REAL; // Volume type
input int maPeriod=5; // Ma indicator period
double volumeBuffer[],ma[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
void OnInit()
{
//--- indicator digits
IndicatorSetInteger(INDICATOR_DIGITS,0);
//----
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total, // number of bars in history at the
current tick
const int prev_calculated,// number of bars calculated at previous
call
const datetime &time[],
const double &open[],
const double& high[], // price array of maximums of price for
the indicator calculation
const double& low[], // price array of minimums of price for
the indicator calculation
const double &close[],
const long &tick_volume[],
const long &volume[],
const int &spread[])
{
int i,limit;
//--- check for bars count
if(rates_total<maPeriod)
return(0);// not enough bars for calculation