logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

2 Pages<12
Options
Go to last post Go to first unread
Faith  
#21 Posted : Tuesday, March 4, 2014 3:21:09 AM(UTC)
Faith

Rank: Newbie

Groups: Registered, Registered Users, Subscribers
Joined: 9/11/2013(UTC)
Posts: 2

Wabbit,

I was trying to use the "PercentRank" code of yours to get the PercentRank of ATR. Following is the modification to your code. But I still do not get the Percentile Rank of the ATR in Exploration. It just gives me "N/A". Any advise, please....

PercentRankATR:=100 * (Sum(ATR(8)>LastValue(ATR(8)+PREVIOUS*0),100) / 100

Thanks

Faith

mstt  
#22 Posted : Tuesday, March 4, 2014 11:39:10 AM(UTC)
mstt

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 7/25/2005(UTC)
Posts: 1,042

Was thanked: 57 time(s) in 54 post(s)
Hi Faith

I suggest you create an output with your code rather than just the variable named "PercentRankATR".

Either use

100 * (Sum(ATR(8)>LastValue(ATR(8)+PREVIOUS*0),100) / 100;
{ or perhaps }
PercentRankATR:=100 * (Sum(ATR(8)>LastValue(ATR(8)+PREVIOUS*0),100) / 100;
PercentRankATR;

This should at least take care of the N/A problem. I find it useful to test these sorts of ideas as an indicator before taking functioning code across to an exploration. Generally it's easier to troubleshoot an indicator than an exploration.

Roy
Faith  
#23 Posted : Wednesday, March 12, 2014 4:37:50 AM(UTC)
Faith

Rank: Newbie

Groups: Registered, Registered Users, Subscribers
Joined: 9/11/2013(UTC)
Posts: 2

Hi Roy

Thanks for that. Much appreciated.

Faith

viking4020  
#24 Posted : Friday, November 25, 2016 1:08:32 PM(UTC)
viking4020

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 10/16/2009(UTC)
Posts: 33
Location: Redcliffe, QLD Australia

Thanks: 4 times
Was thanked: 1 time(s) in 1 post(s)
Originally Posted by: wabbit Go to Quoted Post
The shape of the charts may look the same, which is because of the weighting of the two major factors in the computation, but notice the values are different.

I have been chatting with another trader and we have also noticed a few other errors/omissions/stuff ups in my code; namely: The text description of what the PercentRank values should be in AB and what is returned by the AB pseudo code are inverted, and, I should have used a comparison between the ROC of the data instead of just comparing the data to itself.

So, my modified code goes something like:

Code:

data:=CLOSE;
lenRSI:=3;
lenStreak:=2;
lenPctRank:=100;
WildersRSI:=RSI(data, lenRSI);
ch:=ROC(data,1,%);
up:=BarsSince(ch<=0);
dn:=BarsSince(ch>=0);
StreakRSI:=RSI(up-dn, lenStreak);
count:=Sum(ch<LastValue(ch+PREV*0),lenPctRank);
PctRank:=100 * count / lenPctRank;
ConnorsRSI:=(WildersRSI + StreakRSI + PctRank) / 3;
{plot}
ConnorsRSI;


I would like to compare the results of this code with AB, but I have found that my version of AB doesn't have the PercentRank function (which was allegedly incorporated into AB3.4 but doesn't exist in my AB5.3 ??) and me re-writing the PercentRank function defeats the purpose of the cross-application checking.... and I don't know of any other reliable source of data to check this with.



wabbit [:D]

Hi

In the ConnorsRSI...

Just wondering if it is a 0 or O.

count:=Sum(ch<LastValue(ch+PREV*0),lenPctRank);

A 0 (zero) does not make sense, but that is what is typed.

...viking4020

viking4020  
#25 Posted : Friday, November 25, 2016 1:11:48 PM(UTC)
viking4020

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 10/16/2009(UTC)
Posts: 33
Location: Redcliffe, QLD Australia

Thanks: 4 times
Was thanked: 1 time(s) in 1 post(s)

Hi 

In the ConnorsRSI, the below line is not clear...

Just wondering if it is a 0 (zero) or O (Oh)?

count:=Sum(ch<LastValue(ch+PREV*0),lenPctRank);

A 0 (zero) does not make sense, but that is what is typed.

...viking4020

cracker  
#26 Posted : Monday, November 28, 2016 1:04:05 AM(UTC)
cracker

Rank: Newbie

Groups: Registered, Registered Users
Joined: 5/19/2006(UTC)
Posts: 7

Was thanked: 1 time(s) in 1 post(s)
It's a zero... exploiting a trick of PREV
viking4020  
#27 Posted : Sunday, December 4, 2016 10:34:49 AM(UTC)
viking4020

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 10/16/2009(UTC)
Posts: 33
Location: Redcliffe, QLD Australia

Thanks: 4 times
Was thanked: 1 time(s) in 1 post(s)
What is the point of... PREV*0 in the ConnorsRSI code? It will always be zero? Wabbit can you please comment. An old post but a good one. Viking4020
viking4020  
#28 Posted : Sunday, December 4, 2016 10:36:32 AM(UTC)
viking4020

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 10/16/2009(UTC)
Posts: 33
Location: Redcliffe, QLD Australia

Thanks: 4 times
Was thanked: 1 time(s) in 1 post(s)
Cracker What's the trick? Viking4020
cracker  
#29 Posted : Monday, December 5, 2016 1:41:49 AM(UTC)
cracker

Rank: Newbie

Groups: Registered, Registered Users
Joined: 5/19/2006(UTC)
Posts: 7

Was thanked: 1 time(s) in 1 post(s)
LastValue(something + PREV * 0) is not a math function. It's not the same as LastValue(something + 0) It's the dynamic current value of "something" on each bar. MS does weird stuff when you combine LastValue and PREV. MSTT explained it better a long time ago in his newsletters. Accept that it gets around a limitation in metastock code, which works. Sometimes you might see it written LastValue(something + PREV - PREV) which achieves pretty much the same thing but is slower. So the code count:=Sum(ch<LastValue(ch+PREV*0),lenPctRank); says, get the value of ch on the bar being considered, then, for the lenPctRank number of bars before this bar, compare the value of ch on those bars with the value of ch on the bar being considered. Count 1 if smaller.
thanks 1 user thanked cracker for this useful post.
viking4020 on 12/5/2016(UTC)
Users browsing this topic
Guest (Hidden)
2 Pages<12
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.