Syntax
public PercentRank(DataSeries ds, int period, string description)
public static PercentRank Series(DataSeries ds, int period)
public PrcRank(DataSeries ds, int period, string description)
public static PrcRank Series(DataSeries ds, int period)
Parameter Description
ds |
DataSeries |
period |
Lookback period |
Description
Returns percent rank of the current element of the DataSeries within all elements over the specified period. Matches Excel's function.
There exist 2 implementations: PercentRank courtesy
DartBoardTrader (Michael Bytnar), PrcRank courtesy
avishn (Andrew).
Example
The following example will compare the 2 implementations of PercentRank:
using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using WealthLab;
using Community.Indicators;
namespace WealthLab.Strategies
{
public class MyStrategy : WealthScript
{
protected override void Execute()
{
PercentRank pr = PercentRank.Series(Close,252);
PrcRank pc = PrcRank.Series(Close,252);
ChartPane p = CreatePane( 30,true,true );
PlotSeries( p, pr, Color.Red, WealthLab.LineStyle.Solid, 1 );
PlotSeries( p, pc, Color.Blue, WealthLab.LineStyle.Solid, 1 );
}
}
}