Everything about RSI - page 23

 

...

cja:
I found this decompiled SAR indicator on one of the forums and although I don't usually waste my time with decompiled indicators I had a play with it and converted it to RSI, I have had it for a long time so I am not even sure if it works properly but it may give some clues for code

Regards CJA

para_rsi.v1.mq4.

Thanks CJA...I used to have this one...but deleted by mistake a long time ago...it worked:)

 

...

using RSI (1) average...

Files:
b_1.jpg  174 kb
 
Pava:
using RSI (1) average...

please post bottom indictor as shown in the image RSI

thanks

 

...

Here is one more RSI with parabolic SAR applied to it.

I simply used the existing parabolic SAR and replaced high and low prices with RSI. Rsi can be smoothed (triangular ma used (regular, non-recalculating triangular moving average, so no recalculating)) or in its raw format. So no need to try to decipher decompiled code : it is much easier to read this one.

PS: there will be difference between this one and the one posted by cja. This one is using the smoothed (or unsmoothed, if Smooth rsi is set to <= 1) in calculation, while that one is always using unsmoothed value in calculation (not the one you see on chart) so the difference will come from that

Files:
 

RSI's by MLADEN

Thanks for the nice Indicators

Files:
rsi_5.gif  30 kb
 

...

mladen:
Here is one more RSI with parabolic SAR applied to it.

I simply used the existing parabolic SAR and replaced high and low prices with RSI. Rsi can be smoothed (triangular ma used (regular, non-recalculating triangular moving average, so no recalculating)) or in its raw format. So no need to try to decipher decompiled code : it is much easier to read this one.

PS: there will be difference between this one and the one posted by cja. This one is using the smoothed (or unsmoothed, if Smooth rsi is set to <= 1) in calculation, while that one is always using unsmoothed value in calculation (not the one you see on chart) so the difference will come from that

Thank You...Good one!

 

RSI & Average & Alerts - Test Display Values

Use this one.

This one allows even rsi length 1 (which is impossible with the built in metatrader rsi).]

Hi Mladen,

First of all, I always enjoy reading your posts. Thanks for all your help to so many others here.

And I'm always learning something new from your excellent coding skills...so thanks for all the great indicators to learn from...

I have a few questions about the indicator you recently posted - RSI & Average & Alerts

I have not see this type of coding in an indicator before...so...to study it...I added screen comments to watch the indicator values changing on the chart as I ran it on the strategy tester.

What I found was curious -

1) There are 5 buffers - (4) indicated in #property indicator_buffers 4...and (5) in the IndicatorBuffers(5). Should these match?

2) In the Plot and CleanPoint functions...I know what a basic "double" variable is...but what does "double&" mean? All I found in the MT4 documentation was that it is used to import something? I don't see any dll import or anything else imported in the indicator?

Plus the CleanPoint function formulas appear different for the "first" and "second" values...? Should the second have..."&& (second"...to match..."&& (first"..or is there a reason that is left off for the second value? (Line 207 in test version)

3) Where do the values for rsiada and rsiadb get assigned? I could not find any place where they get their values? I'm usually able to trace the values through the indicators...but not this one? How are you doing this mystery coding to assign rsiada and rsiadb buffers their values...?

When I watch the indicator values and lines changing on the chart...the Slope value appears fine changing from 1 to -1, along with the constant changing rsi and rsia values and line colors.

To display the values, I named them rsiada UP and rsiadb DN...as I thought that's what they represented...but after I watched the indicator a number of times, they don't seem to have a direct correlation?

4) In addition, as I watch the screen values...the rsiadb values don't change much at all, most always showing the "empty value - 2127483647" and changing only rarely. It's mostly just the rsiada values changing all the time. I was assuming the RSI crossing down and the PaleVioletRed Line going down would set the rsiab values as the down trend, but the rsiadb values rarely changed. Quite confusing. Then I noticed that the color PaleVioletRed was assigned to both rsiada and rsiadb...so I changed the rsiadb color to Yellow just to see what it was doing...and then I could finally match up the rare rsiadb values with the Yellow Line when it showed up.

So now I can see both the rsiadb value and the Yellow Line when they finally occur...only as a quick short Yellow section...but still they rarely show up at all...seems like it's an unbalanced ratio like "100 rsiada" to "1 rsiadb" or something odd like that...? Seems the ratio would average out balanced over time (as most cycles do).

5) Was there a reason you colored both rsiada and rsiadb the PaleVioletRed color...and why does rsiadb show up so rarely and what does it actually represent...?

I have attached my test version with the screen display for the values with the Yellow line changes to show this condition...

Test Version = RSI & Average & Alerts - Test-DisplayValues

Thanks in advance for any help in understanding how this indicator works...!

Robert

 

...

The answers :

  1. No. There are 4 drawing buffers and one extra calculation only buffer. Hence the difference : the additional (slope) buffer is there in order to "remember" the slope of the average of the rsi. That is a usual way to allocate working (calculation only) buffers that are not going to be drawn on chart
  2. "double&" is a pass by reference of some value (an array of double values in the case described). In this case Io use it in order to change the drawing buffers content directly in the procedure without a need to know which those buffers exactly are
  3. in PlotPoint() (the assignment) : the "first" and the "second" are again passed by reference which means that in this case rsida and rsidb buffer values are altered
  4. rsidb is there to ensure non-repainting mode (it needs to be done that way or else metatrader will over-draw some values and then slopes would not be colored correctly). If only one buffer was used for second color then it would repaint (that is the way how to avoid the never ending story of repainting - you know that I told a lot of times that "repainting is a coding error" - this is one of the ways to avoid it)
  5. it is covering a a special case when the repainting would happen (you can even visually see when wuld it happen - it is a case when single bar color changes happen), and that is why it is happening so rarely. Set the average period to short value and you will see it much more

regards

Mladen

mladen:
Use this one.

This one allows even rsi length 1 (which is impossible with the built in metatrader rsi).]

Hi Mladen,

First of all, I always enjoy reading your posts. Thanks for all your help to so many others here.

And I'm always learning something new from your excellent coding skills...so thanks for all the great indicators to learn from...

I have a few questions about the indicator you recently posted - RSI & Average & Alerts

I have not see this type of coding in an indicator before...so...to study it...I added screen comments to watch the indicator values changing on the chart as I ran it on the strategy tester.

What I found was curious -

1) There are 5 buffers - (4) indicated in #property indicator_buffers 4...and (5) in the IndicatorBuffers(5). Should these match?

2) In the Plot and CleanPoint functions...I know what a basic "double" variable is...but what does "double&" mean? All I found in the MT4 documentation was that it is used to import something? I don't see any dll import or anything else imported in the indicator?

Plus the CleanPoint function formulas appear different for the "first" and "second" values...? Should the second have..."&& (second"...to match..."&& (first"..or is there a reason that is left off for the second value? (Line 207 in test version)

3) Where do the values for rsiada and rsiadb get assigned? I could not find any place where they get their values? I'm usually able to trace the values through the indicators...but not this one? How are you doing this mystery coding to assign rsiada and rsiadb buffers their values...?

When I watch the indicator values and lines changing on the chart...the Slope value appears fine changing from 1 to -1, along with the constant changing rsi and rsia values and line colors.

To display the values, I named them rsiada UP and rsiadb DN...as I thought that's what they represented...but after I watched the indicator a number of times, they don't seem to have a direct correlation?

4) In addition, as I watch the screen values...the rsiadb values don't change much at all, most always showing the "empty value - 2127483647" and changing only rarely. It's mostly just the rsiada values changing all the time. I was assuming the RSI crossing down and the PaleVioletRed Line going down would set the rsiab values as the down trend, but the rsiadb values rarely changed. Quite confusing. Then I noticed that the color PaleVioletRed was assigned to both rsiada and rsiadb...so I changed the rsiadb color to Yellow just to see what it was doing...and then I could finally match up the rare rsiadb values with the Yellow Line when it showed up.

So now I can see both the rsiadb value and the Yellow Line when they finally occur...only as a quick short Yellow section...but still they rarely show up at all...seems like it's an unbalanced ratio like "100 rsiada" to "1 rsiadb" or something odd like that...? Seems the ratio would average out balanced over time (as most cycles do).

5) Was there a reason you colored both rsiada and rsiadb the PaleVioletRed color...and why does rsiadb show up so rarely and what does it actually represent...?

I have attached my test version with the screen display for the values with the Yellow line changes to show this condition...

Test Version = RSI & Average & Alerts - Test-DisplayValues

Thanks in advance for any help in understanding how this indicator works...!

Robert
 

Thanks...!

:)

The answers :

  1. No. There are 4 drawing buffers and one extra calculation only buffer. Hence the difference : the additional (slope) buffer is there in order to "remember" the slope of the average of the rsi. That is a usual way to allocate working (calculation only) buffers that are not going to be drawn on chart
  2. "double&" is a pass by reference of some value (an array of double values in the case described). In this case Io use it in order to change the drawing buffers content directly in the procedure without a need to know which those buffers exactly are
  3. in PlotPoint() (the assignment) : the "first" and the "second" are again passed by reference which means that in this case rsida and rsidb buffer values are altered
  4. rsidb is there to ensure non-repainting mode (it needs to be done that way or else metatrader will over-draw some values and then slopes would not be colored correctly). If only one buffer was used for second color then it would repaint (that is the way how to avoid the never ending story of repainting - you know that I told a lot of times that "repainting is a coding error" - this is one of the ways to avoid it)
  5. it is covering a a special case when the repainting would happen (you can even visually see when wuld it happen - it is a case when single bar color changes happen), and that is why it is happening so rarely. Set the average period to short value and you will see it much more

regards

Mladen

cosmiclifeform:

Thanks for the detailed description of how this indi works.

Before I didn't quite understand what the "pass through values" were when I read the not so good MT4 documentation.

You helped a lot! Makes much more sense now.

And I see what you mean about using rsiabd to avoid the repainting issue. Interesting approach!

Thanks so much for your help with this..! I'm learning a lot..and still have a lot more to learn..!

Take care and thanks,

Robert

 

Parabolic RSI 2 ...

As a consequence of this post : https://www.mql5.com/en/forum/177358

This one is upgraded, updated and more options added to it. Also, it is suing a kind of a "generic" RSI. Instead of using one RSI for calculation it is using two RSIs : rsi of high and rsi of low. The value displayed is an average of those 2 (that way it becomes a generic - it is not the same as if one would use rsi of median price). This version uses the correct parabolic function (it can be used as a template how to use the function on any value) and is "abusing" almost all that that function can output as a result. Added alerts too. Also, it is faster (it calculates only the necessary number of changed bars, for one)

Files:
Reason: