You're running it like an expert_advisor. Identify it as indicator, place it within the correct folders, do-some reading about indicators instead of trial and error.
example:
#property indicator_separate_window #property indicator_buffers 1 void start(){ int counted_bars=IndicatorCounted(); Comment("counted_bars=",counted_bars); }
ubzen:
You're running it like an expert_advisor. Identify it as indicator, place it within the correct folders, do-some reading about indicators instead of trial and error.
example:
yes, it is.
thanks,
vx0532: According to my understanding, "IndicatorCounted()" will return "-1" when it was loaded at the first time a
But when I run below codes, I see that the parameter, "counted_bars", always is -1 and constant repeatly.
- False IndicatorCounted() function returns the count of bars minus one. If IndicatorCounted is "always is -1" something is wrong like using indicator functions in a EA or script.
- No decrement Contradictory information on IndicatorCounted() - MQL4 forum
//b4plusdi=iADX(NULL,0,ADXbars,PRICE_CLOSE,MODE_PLUSDI,shift+1); int lookback = ADXbars +1; int shift,counted_bars=IndicatorCounted(); if(counted_bars < lookback) counted_bars = lookback; for (shift = Bars - 1 - CountBars; shift>=0; shift--)

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
According to my understanding, "IndicatorCounted()" will return "-1" when it was loaded at the first time and will return the mount of "effective bars" from the second loaded or executed.
But when I run below codes, I see that the parameter, "counted_bars", always is -1 and constant repeatly.
I don't know why and how shall get the effective bars by "IndicatorCounted() "?