I have used the code below to replicate the RSI indicator, as a small learning exercise, but I get different result then the built in one that I apply on graph. Why?
You need to provide more information, such as screenshots comparing the differences, and/or more complete codes with your data/array declarations, etc.
You need to provide more information, such as screenshots comparing the differences, and/or more complete codes with your data/array declarations, etc.
Hi, I have updated my question. Please have a look and correct any mistake I made.
Hi, I have updated my question. Please have a look and correct any mistake I made.
Ok, looks like you'll just need to add these two lines (highlighted):
#property indicator_separate_window #property indicator_minimum 0 #property indicator_maximum 100
Ok, looks like you'll just need to add these two lines (highlighted):
Ok, looks like you'll just need to add these two lines (highlighted):
it makes no difference.
it makes no difference.
You can refer to the documents here: https://docs.mql4.com/basis/preprosessor/compilation
They should set the minimum and maximum prices of your indicator. If they don't make any difference, it's time to show your complete code so I can run it on my terminal to see.
- docs.mql4.com
I think it is running ok now, after I have restarted my computer.......
but now, then say I want to apply RSI 3 on RSI 14, it does not show. RSI 3 is always zero.
RSI_14[i]=iRSI(Symbol(),0,14,PRICE_CLOSE,i); RSI_3[i]=iRSI(Symbol(),0,3,RSI_14[i],i);
but now, then say I want to apply RSI 3 on RSI 14, it does not show. RSI 3 is always zero.
This is what you should use: https://docs.mql4.com/indicators/irsionarray
I have made the following changes and I still don't get a sensible graph, zero all time.
RSI_14[i]=iRSI(Symbol(),0,14,PRICE_CLOSE,i); RSI_5[i]=iRSIOnArray(RSI_14,14,5,i);
in here, I use 14 number of element, average period of 5, I tried either i or 0 for shift, and dont get a graph.
What have I misunderstood?
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi all
I have used the code below to replicate the RSI indicator, as a small learning exercise, but I get different result then the built in one that I apply on graph.
Why?
Below is the screenshot, grey is the MT4 built-in one, blue is mine, both are calculated using Price_close.