Do not double post.
Your other topic has been deleted.
sanjayrao: I need to calculate the average of b1,b2,b3,b4,b5,b6 … Any help
- Don't double post! You already had this thread open.
General rules and best pratices of the Forum. - General - MQL5 programming forum - Please edit
your (original) post and use the CODE button
(Alt-S)! (For large amounts of code, attach it.)
General rules and best pratices of the Forum. - General - MQL5 programming forum
Messages Editor -
Why did you post your MT4 question in the
Root /
MT5 General section instead of the MQL4 section,
(bottom of the Root page?)
General rules and best pratices of the Forum. - General - MQL5 programming forum
Next time post in the correct place. The moderators will likely move this thread there soon. -
You should stop using the old IndicatorCounted and start using the new
Event Handling Functions.
Event Handling Functions - Functions - Language Basics - MQL4 Reference
How to do your lookbacks correctly. - If you want to calculate an average, why are you putting values in separate arrays? Do you really want to average all values in b1[] plus all values in b2[], etc.? Just get the values and average the variables.
- iClose is a price (1.23456) iCCI is an oscillator, (±300.) Nonsense to subtract them. What is the meaning of 10 miles - latitude 90°‽
- Help you with what?
You haven't stated a problem, you stated a want.
Show us your attempt
(using CODE button) and state
the nature of your problem.
No free help
urgent help.
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
Tried to search but didnt find a solution. I am trying to write an indicator where I need an average value of the list of indicator values and plot that in a separate window.
code:
I need to calculate the average of b1,b2,b3,b4,b5,b6 and then plot that on the chart. Any help is greatly appreciated. Thanks in advance.
******************************************************************
int start()
{
int counted_bars=IndicatorCounted();
//----
for(int i=Bars-counted_bars-1;i>=0;i--)
{
b1[i]=(iClose(s1,Period(),i)-iCCI(s1,Period(),period,0,i))/MarketInfo(s1,MODE_POINT);
b2[i]=(iClose(s2,Period(),i)-iCCI(s2,Period(),period,0,i))/MarketInfo(s2,MODE_POINT);
b3[i]=(iClose(s3,Period(),i)-iCCI(s3,Period(),period,0,i))/MarketInfo(s3,MODE_POINT);
b4[i]=(iClose(s4,Period(),i)-iCCI(s4,Period(),period,0,i))/MarketInfo(s4,MODE_POINT);
b5[i]=(iClose(s5,Period(),i)-iCCI(s5,Period(),period,0,i))/MarketInfo(s5,MODE_POINT);
b6[i]=(iClose(s6,Period(),i)-iCCI(s6,Period(),period,0,i))/MarketInfo(s6,MODE_POINT);
return(0);
}