RE: How to create the Mansfield Relative Performance Indicator
I have coded this on Amibroker. Please let me know if there is something I need to improve on.
+++
_SECTION_BEGIN("MansfieldRelativePerformance");
/*
Mansfield Relative Performance indicator
The formula of this indicator is a bit more difficult than the regular Standard Relative Performance indicator:
Code:
MRP = (( RP(today) / sma(RP(today), n)) - 1 ) * 100
Where:
RP = Standard Relative Performance indicator (see above)
SMA = Simple moving average over n days.
n = 52 for weekly charts, and n = 200 on daily charts
*/
TimeFrameSet(inWeekly);
maPeriod = Param( "Weeks", 52, 0, 500, 1 );
rsSymbol = ParamStr( "Index Symbol", "NSENIFTY" ); //Change the symbol to your Index
rs = ( Close / Foreign( rsSymbol,"Close" ) );
RSC = 10*(( rs / MA( rs, maPeriod ) ) - 1);
TimeFrameRestore();
RscMansfield = TimeFrameExpand(Rsc,inWeekly,expandLast);
Plot( 0, "Line 0", colorBlue, styleLine);
Plot( RscMansfield,"RscMansfield",ParamColor( "Color", colorAqua ),1);
PlotOHLC(RscMansfield,RscMansfield,0,RscMansfield,"", IIf( RscMansfield > 0, ParamColor("Up Color", colorGreen ), ParamColor("Down Color", colorRed ) ),
styleCloud);
_SECTION_END();
+++