Works Well.
Thank you for sharing it.
Just attaching an idea . I am not a coder and not sure if it's feasible.
Another indicator prints text and when you find time, please do update it.
Did anyone fix the indicator displaying blank?
I am getting the same thing.
I believe i have fixed it. I think it is an issue with our broker and supplying VOLUME_REAL data for derived instruments.
I changed the if statements to default to VOLUME_TICK, and this got the indicator to work.
Did anyone fix the indicator displaying blank?
I am getting the same thing.
I believe i have fixed it. I think it is an issue with our broker and supplying VOLUME_REAL data for derived instruments.
I changed the if statements to default to VOLUME_TICK, and this got the indicator to work.
Thanks for the easy solution. :)
Did anyone fix the indicator displaying blank?
I am getting the same thing.
I believe i have fixed it. I think it is an issue with our broker and supplying VOLUME_REAL data for derived instruments.
I changed the if statements to default to VOLUME_TICK, and this got the indicator to work.
Thanks for the info. I have attached the fixed mq5 file if anyone needs it (note: you have to click "Go to discussion" link to see the attachment)
Good morning, would it be possible to have it for MT4?
I had it on my old PC but it was stolen and in the backup I made some things were left out due to my carelessness.
Thank you.
Custom, now you can watch volatility on bars SYMBOL_PRICE_VOLATILITY
Auto-translation applied by moderator
//+-------------------------------------------------------------------------------------+ //| Minions.BetterVolume.mq5 | //| (CC) Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License| //| http://www.MinionsLabs.com | //+-------------------------------------------------------------------------------------+ //+------------------------------------------------------------------+ //| Descriptors | //+------------------------------------------------------------------+ #property copyright "www.MinionsLabs.com" #property link "http://www.MinionsLabs.com" #property version "1.0" #property description "Minions in the quest for explaining Volume in a better way." #property description " " #property description "(CC) Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License" //+------------------------------------------------------------------+ //| Indicator Settings | //+------------------------------------------------------------------+ #property indicator_separate_window #property indicator_buffers 2 #property indicator_plots 1 #property indicator_label1 "Better Volume" #property indicator_type1 DRAW_COLOR_HISTOGRAM #property indicator_color1 C'20,20,20', clrLime, clrRed #property indicator_style1 STYLE_SOLID #property indicator_width1 4 //+------------------------------------------------------------------+ //| INPUT Parameters | //+------------------------------------------------------------------+ input ENUM_SYMBOL_INFO_DOUBLE inpAppliedVolume = SYMBOL_VOLUME_MAX; // Volume Type input int inpBarsToAnalyze = 20; // N past bars to analyze //+------------------------------------------------------------------+ //| Global Variables | //+------------------------------------------------------------------+ double bufferVolume[]; double bufferColors[]; // safe check & clean all Input Parameters... just in case this indicator is called via iCustom()... ENUM_SYMBOL_INFO_DOUBLE paramAppliedVolume = (inpAppliedVolume == NULL ? SYMBOL_VOLUME_MAX : (ENUM_SYMBOL_INFO_DOUBLE)inpAppliedVolume); int paramBarsToAnalyze = (inpBarsToAnalyze == NULL ? 20 : (int)inpBarsToAnalyze); //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ void OnInit() { SetIndexBuffer( 0, bufferVolume, INDICATOR_DATA ); SetIndexBuffer( 1, bufferColors, INDICATOR_COLOR_INDEX ); IndicatorSetString(INDICATOR_SHORTNAME,"Minions.BetterVolume ("+EnumToString(inpAppliedVolume)+", Period:"+(string)paramBarsToAnalyze+")"); IndicatorSetInteger(INDICATOR_DIGITS,0); } //+------------------------------------------------------------------+ //| Volume Calculation... | //+------------------------------------------------------------------+ int OnCalculate(const int rates_total, const int prev_calculated, const datetime &time[], const double &open[], const double &high[], const double &low[], const double &close[], const long &tick_volume[], const long &volume[], const int &spread[]) { int start=prev_calculated-1; long SMA; if (rates_total<2) { return(0); } // check for rates total if (start<1) { start=1; } // correct position // calculates the volumes histogram... for(int i=start; i<rates_total && !IsStopped(); i++) { bufferVolume[i] = (double)(paramAppliedVolume==SYMBOL_VOLUME_MAX ? volume[i] : tick_volume[i]); // calculates the indicator... if(paramAppliedVolume==SYMBOL_VOLUME_MAX) { SMA = SMAOnArray(volume, paramBarsToAnalyze, i ); } else { SMA = SMAOnArray(tick_volume, paramBarsToAnalyze, i ); } // change candle colors accordingly... if (open[i]<close[i] && bufferVolume[i]>SMA) { bufferColors[i]=1.0; } else if (open[i]>close[i] && bufferVolume[i]>SMA) { bufferColors[i]=2.0; } else { bufferColors[i]=0.0; } } return(rates_total); } //+------------------------------------------------------------------+ //| Calculates a SMA over an indicator array... | //+------------------------------------------------------------------+ long SMAOnArray( const long &array[], int period, int position ) { long sum = 0; if (position-period <= 0) { return false; } for (int i = position-period+1; i<=position; i++) { sum += array[i]; } return sum / period; } //+------------------------------------------------------------------+
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Better Volume:
Easy and visual way to check abnormal changes in Volume.
Author: Minions Labs