Basic example:
// Indicator 1: Hist1b int Hist1a(int i) { if (Low[i] < Low[i-1]) return 1; else return 0; } int Hist1b(int i) { if (Hist1a(i) == 1 && Hist1a(i-1) == 1) return 1 + Hist1b(i-1); else return 0; } // Indicator 2: Hist2b int Hist2a(int i) { if (Volume[i] < Volume[i-1]) return 1; else return 0; } int Hist2b(int i) { if (Hist2a(i) == 1 && Hist2a(i-1) == 1) return 1 + Hist2b(i-1); else return 0; } // Indicator 3: Moving Average double MA(int i) { return Hist1b(i) + Hist2b(i); }
Hello, thank you for your message
I tried but there is no indicator displayed

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
I would like to calculate a moving average, not from prices but from 2 histograms which accumulate values, in this way :
(Hist2b) : as long as Hist2a[n] = 1 & Hist2a[n-1] = 1 --> = 1 + Hist2a[n-1] otherwise 0
MA = Hist1b + Hist2b
It seems that this is not possible on the same window because the histograms would sometimes be superimposed, is there a way or is it impossible ?