![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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
1. Flat line in the begining of the indicator.
You did not used the SetIndexDrawBegin function and you shold becouse CMO calculates current values using CMO_Period number of previous bars. So somewhere in init() function you should put line:
2. You do not used the standard Indexes but dynamic arrays. I not completely sure but I think current algorytm may give wrong resluts. When the new bar is formed standard buffers are automatically resized and your dynamic arrays are not so it is potencial risk. You would better use standard buffers.
3. Calculation of cmo1 and cmo2 should be carried from limit+CMO_Period-1 till 0 not from limit till 0 becouse while calculating smo1 and scmo2 you itereate over cmo1[] and cmo2[] till limit+CMO_Period-1.
I analysed your code and found some interesting things about mql4.
1. Flat line in the begining of the indicator.
You did not used the SetIndexDrawBegin function and you shold becouse CMO calculates current values using CMO_Period number of previous bars. So somewhere in init() function you should put line:
2. You do not used the standard Indexes but dynamic arrays. I not completely sure but I think current algorytm may give wrong resluts. When the new bar is formed standard buffers are automatically resized and your dynamic arrays are not so it is potencial risk. You would better use standard buffers.
3. Calculation of cmo1 and cmo2 should be carried from limit+CMO_Period-1 till 0 not from limit till 0 becouse while calculating smo1 and scmo2 you itereate over cmo1[] and cmo2[] till limit+CMO_Period-1.
Scalony,
Congratulations!!!
You solved the three issues with a single shot!!
It is very rewarding to complete this indicator after so many troubles.
I learned a lot of MQL4 with this experience.
What do you think of putting this indicator in the code base? I believe that you deserve this honor, so if you want, please, put it there.
Thank you very much for your collaboration!
Thank you for your collaboration too!
Now I am testing this indicator on my account and it seems to work quite well, and profitable.
I also added some color coding, you may find it usefull.
Before putting it to code base we should do some more cleaning and put comments.
Thank you for your collaboration too!
Now I am testing this indicator on my account and it seems to work quite well, and profitable.
I also added some color coding, you may find it usefull.
Before putting it to code base we should do some more cleaning and put comments.
Ok, I agree.
I have one sujestion for the code:
if(cmo4 == 0)cmo4=0.0001;
cmo[i] = (cmo3/cmo4)*100;
What do you think?
About the colors, it is very good but I found something interesting about the buy and sell signals:
Chande Momentum Oscilador (CMO)
Abstract:
The Chande Momentum Oscillator is a momentum advanced oscillator derived from a linear regression.
Interpretation:
The growing movement in the value of the CMO may indicate a strong bull movement of the price. On the other hand, falls in the value of the CMO may indicate a strong bear movement. CMO is related to the MACD and the Price Rate of Change (ROC Price).
If the CMO is greater than the upper trigger, then a signal of sell is triggered. If the CMO is greater than the lower trigger, then a buy signal is triggered.
The recommended triggers are -50 and 50.
Cheers,
Has this indicator been perfected yet? If not, where can I find a CMO indicator that is useable?
Thanks
Darcy
Thank you very much!
Pieter