I have the same problem with others indicators and I don't know how to fix it too.
The indicator only refreshes when I click on compile.
rodrigosm:
I have the same problem with others indicators and I don't know how to fix it too.
The indicator only refreshes when I click on compile.
try this:
//+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() RefrehRates(); { int counted_bars=IndicatorCounted(); //---- TODO: add your code herehttps://docs.mql4.com/windows/RefreshRates
- The indicator is running every tick, refresh rates is not required and will not do anything.
for(cb=Bars-counted_bars-Range-1;cb>=0;cb--)
The intent was to process bars-1-range...0 but after the first run it processes 0-range..0 which means it doesn't update.for(cb=Bars-MathMax(counted_bars,Range)-1;cb>=0;cb--)
should do it.for(i=cb;i<=cb+Range-1;i++)
for efficiency, simplify:for(i=cb;i< cb+Range ;i++)
if(Bars<=Range) return(0); else { ...
for coding there is no need for an else, simplify:if(Bars<=Range) return(0); ...
And if the for loop is done correctly, this If is unnecessary.
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
Hi all,
i am trying to fix this indicator but didn't have success yet.
Can anybody help me?
The problem is that it not refreshes automatically.
Here's the code
Thanks