Moving Average of RSI

Hello,
I am trying to plot the 30 MAV of RSI (30)...here is my code...I've bolded the line that I am uncertain about...is this syntax correct for the 30 day MA of RSI???

_SECTION_BEGIN("RSI");
SetChartOptions(0,0,chartGrid30|chartGrid70);
periods = MA(RSI(30),30);
periods = Remap( periods, LastValue( Lowest( periods ) ), LastValue( Highest( periods ) ), 0, 2 );  //all bars
Plot (periods, _DEFAULT_NAME(), ParamColor( "Color", colorCycle ), ParamStyle("Style") ) ;
_SECTION_END();

Thanks in advance

@stevercar144 - when you post the code make sure you use Code Tags as explained here: How to use this site otherwise your formulas will be corrupted. This time I have fixed your post to include code tags.

THank you...will read the how to, learning something new every day....

Hi Steve,

Could you please explain why you want to use Remap here? It is not necessary to use Remap all the time, Plot function is sufficient 99% of the time. It purely depends on your specific requirements, especially, when you draw using GFXs as shown in the example in the guide.

So, you could simply write:

_SECTION_BEGIN( "Moving Average of RSI" );
perRSI = Param( "RSI Periods", 30, 1, 1440, 1 );
perMA  = Param( "RSI MA Periods", 30, 1, 1440, 1 );

OverSoldLvl = Param( "Over Sold Level", 30, 1, 100, 1 );
OverBghtLvl = Param( "Over Bought Level", 70, 1, 100, 1 );

maRSI = MA( RSI( perRSI ), perMA );
Plot( maRSI, "MA RSI", ParamColor( "Color", colorCycle ), ParamStyle( "Style" ) );

PlotGrid( OverSoldLvl, colorBlueGrey, 8 );
PlotGrid( OverBghtLvl, colorBlueGrey, 8 );
_SECTION_END();

P.S. While writing AFL after the User Manual, this webpage is your best friend, because it categorically enlists all the functions. You can also use Context help from AFL Editor to access guide of each and every function that you would be using. Quoting from AFL Editor guide:

You can quickly display relevant AFL function reference page if you press F1 key or choose "Function reference" from the context menu while the caret is inside or right after function name as shown in the picture below:

1 Like

Cheers for the reply, (I am a complete novice at Amibroker so am trying to take in everyone's comments)
I am remapping because I want an indicator that gives a standardised score across all stocks. So If I scan for all stocks above x score on the indicator I know all stocks returned are comparable on that score. I want a relative score across the universe of stocks.
EG. return all stocks with score of > 1.5. Hope that makes sense.
My question though, was whether I had the formula right for the MA of RSI...seems not...thanks for the input.

Analysis Window and Chart Window are different! Remapping a Chart won't help you achieve anything while Scanning stocks.

Please refer to the Ranking functionality guide while Scanning. Quoting from there:

A ranking is a relationship between a set of items such that, for any two items, the first is either 'ranked higher than', 'ranked lower than' or 'ranked equal to' the second. The simplest way to obtain the rank is to sort items by 'value' or 'score'.

For visual on Charts you may refer to the Relative Performance.afl from Basic Charts section of AFL Editor, just replace the Close there with your calculated Score.

It should also be noted that RSI already provides a "standardized score". The value will always be between 0 and 100. Therefore, any average of RSI will also provide a value between 0 and 100.

3 Likes

Yes Matt, rightly said!

Steve did not mention anything about "Score" or "Rank" in his first post here. And has created a different thread:

Yes RSI, Stochastic, ROC% or any other Oscillator that fluctuates within a defined range, can just be plotted using Foreign for visual Ranking purposes.

But if the Ranking or Scoring is done based on Moving Average of Price or any of Price's derivatives (like CCI) which cannot be defined within a pre-defined range then Relative Performance would be required.