Hi,
For a look back period of 200 days, I want to know the percent rank of current day's return from yesterday.
I tried with these codes but don't know how to set the three inputs for the PercentRankArray function.
Anyone can help please? Thanks.
Array: intrabarpersist DailyReturn[199](0);
Inputs: Len(200);
vars: counter(0), PctRank(0);
for counter = 0 downto -199 begin
DailyReturn[counter] = percentChange(C,1)[counter];
end;
PctRank = PercentRankArray(PriceValueToRank,PriceValueArray,Size);
plot1(PctRank,"PctRank");
Percent Rank coding
-
- Posts: 108
- Joined: 05 Mar 2014
- Has thanked: 1 time
- Been thanked: 12 times
Re: Percent Rank coding
Are you trying to compare the percent rank of today vs yesterday? Are you sure you want to use percent rank? You may want to review the meaning of percent rank. The inputs are value to rank, the collection to be ranked against, and the lookback period. If I understand you right, it would look something like this. You don't need to use the array-- you can just use the series function.
Value10 = Close-Close[1];
Rank = PercentRank(Value10, Value10,200);
Alternatively, if you don't want to use a lookback of 200 days, start a counter and use it like this:
Counter = IFF(Counter <= 200, Counter+1, 200);
Value10 = Close-Close[1];
Rank = PercentRank(Value10, Value10,200);
Alternatively, if you don't want to use a lookback of 200 days, start a counter and use it like this:
Counter = IFF(Counter <= 200, Counter+1, 200);
Re: Percent Rank coding
Hi tpredictor,
Thanks for your prompt response.
The One-day return I am thinking is (C - C[1]) / C[1].
I want to know the Percent Rank of today's one-day return, when compare to all of the one-day return in the last 199 days.
Thanks
Thanks for your prompt response.
The One-day return I am thinking is (C - C[1]) / C[1].
I want to know the Percent Rank of today's one-day return, when compare to all of the one-day return in the last 199 days.
Thanks
-
- Posts: 108
- Joined: 05 Mar 2014
- Has thanked: 1 time
- Been thanked: 12 times
Re: Percent Rank coding
You should be able to use the example I gave you just replacing out the value10 with your series.