The first thing that catches my eye is that the semicolon is clearly unnecessary here:
User11111:
int OnCalculate(const int rates_total, const int prev_calculated, const int begin, const double &low[], const long &volume[]);
Trying to declare variables between the header and the function definition is also a bad idea:
(Check out the documentation: https://www.mql5.com/en/docs/basis/function)
User11111:
int OnCalculate(const int rates_total, const int prev_calculated, const int begin, const double &low[], const long &volume[]); int first, bar; int Hist1a; int Hist1b; {
And your OnCalculate function header does not match any of its 2 possible types:
Vladislav Boyko #:
Thank you Vladislav Boyko for your answer
The first thing that catches my eye is that the semicolon is clearly unnecessary here:
Trying to declare variables between the header and the function definition is also a bad idea:
(Check out the documentation: https://www.mql5.com/en/docs/basis/function)
And your OnCalculate function header does not match any of its 2 possible types:
To be honest it looks like some ChatGPT code with a few personal "tweaks".
There, I said it.

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hello everyone
I work on a custom indicator and begin learning coding following tutorials and articles, after several months some limitations persist and I thought getting your opinion could help me.
Please excuse any possible beginner's mistakes, the basic idea of the indicator may seem simple, but it's the one I'm having the most trouble with in the code.
Any comments will certainly be very useful for my learning!
Thank you for your help
The indicator (and the way I went about transcribing it) :
It consists of 2 histograms and a line
The basic idea is to create 2 variables "Hist1a" and "Hist2a" equal either to 1 or 0
Hist1a=1 if low < previous low and =0 otherwise.
Hist1a values are accumulated in "Hist1b" as long as they are >0.
Hist1b" values are then displayed as a histogram under 2 conditions (so that the graph is not overloaded):
* they are >= 5
* Hist1b[n+1] = 0
The 2nd histogram displayed follows the same process, this time with :
Hist2a=1 if vol<previous vol and =0 otherwise.
The EMAs of Hist1b and Hist2b are calculated and their difference "EMAs" (EMA2-EMA1) is plotted.