I get error by using the indicator StochRSI in some time frame - page 2

 
Mladen Rakic:

That indicator calculates stochastic all wrong. This line :

makes it calculate stochastic period 1 period longer than it should be. Same for smoothing

Use some better stochastic rsi indicator (there are a lot of better versions)


A better one? For example? 

 

Naguisa Unada:

if (counted_bars == 0)

I would like to know what does "counted_bars == 0" mean? In which case can the counted_bars = 0 ?

 
thomas2004:

A better one? For example? 

Some of links:

https://www.mql5.com/en/forum/175037/page369#comment_4586976

https://www.mql5.com/en/code/16701

https://www.mql5.com/en/code/16844

https://www.mql5.com/en/code/17679

https://www.mql5.com/en/code/17167

https://www.mql5.com/en/code/16804

or go to this thread https://www.mql5.com/en/forum/177239 and you can find multiple mt4 versions with all sorts of additions

_________________________________

And if you include dtosc in your search, you shall find dozens more (being that "dtosc" is stochastic rsi too - except that Robert Miner decided not to use the original name but instead simply renamed it to "Dynamic Trader Oscillator" - probably he did not like the original name so much when he discovered that it already exists for years and years :))

Stochastic RSI
Stochastic RSI
  • votes: 11
  • 2016.10.27
  • Mladen Rakic
  • www.mql5.com
This version has 6 sub-types it is actually calculating.
 
thomas2004 :

I would like to know what does "counted_bars == 0" mean? In which case can the counted_bars = 0 ?

counted_bars = IndicatorCounted ();

The counted_bars contains the number of bars that have already been calculated.

However, immediately after starting the program, the number of bars calculated is zero.

In that case, we have to calculate from the beginning, so we decide the first calculation starting position (limit) by the following method.

 if (counted_bars == 0 )
   limit = Bars - (RSI_Periods + Percent_K + Percent_D);
 
Mladen Rakic:

Some of links:

https://www.mql5.com/en/forum/175037/page369#comment_4586976

https://www.mql5.com/en/code/16701

https://www.mql5.com/en/code/16844

https://www.mql5.com/en/code/17679

https://www.mql5.com/en/code/17167

https://www.mql5.com/en/code/16804

or go to this thread https://www.mql5.com/en/forum/177239 and you can find multiple mt4 versions with all sorts of additions

_________________________________

And if you include dtosc in your search, you shall find dozens more (being that "dtosc" is stochastic rsi too - except that Robert Miner decided not to use the original name but instead simply renamed it to "Dynamic Trader Oscillator" - probably he did not like the original name so much when he discovered that it already exists for years and years :))


Many thanks!

 
Naguisa Unada:

The counted_bars contains the number of bars that have already been calculated.

However, immediately after starting the program, the number of bars calculated is zero.

In that case, we have to calculate from the beginning, so we decide the first calculation starting position (limit) by the following method.


Many thanks!

 

You should stop using the old IndicatorCounted and start using the new Event Handling Functions - Functions - Language Basics - MQL4 Reference

See How to do your lookbacks correctly.


Reason: