Forum on trading, automated trading systems and testing trading strategies
When you post code please use the CODE button (Alt-S)!
In future please post in the correct section
I will move this topic to the MQL4 and Metatrader 4 section.
int OnInit() { IndicatorBuffers(3); SetIndexBuffer(0,Willy510Buffer); SetIndexBuffer(1,willy5); SetIndexBuffer(2,willy10); return(INIT_SUCCEEDED); }
Use "rates _ total" instead of Bars, and "prev _ calculated" instead of counted _ bars.
Calculate the limit at program startup (i.e. prev _ calculated == 0) and at other times.
//int counted_bars=IndicatorCounted(); //int limit = Bars-counted_bars-1; int limit; if (prev_calculated == 0) limit = rates_total - 10; else limit = rates_total - prev_calculated;
//Willy510Buffer[i] = iMA(NULL,0,13,8,MODE_SMMA,PRICE_MEDIAN,i);
Willy510Buffer[i] = willy5[i] - willy10[i];
I don't know whether it's useful.
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 I am a new in MQL and using MQL4 I have a code that gives index out of range error. Even though I understand the error I could not figure out how to fix it.
Actually, it is a part of code which I want to take the moving average of willy r for 5 and 10 days then get the difference and just started to write.
I hope you can help me.