Download software Tutorial videos
Subscription & data-feed pricing Class schedule


New account application Trading resources
Margin rates Stock & option commissions

Attention: Discussion forums are read-only for extended maintenance until further notice.
Welcome Guest, please sign in to participate in a discussion. Search | Active Topics |

trying to transfer a formula Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
mar955
Posted : Friday, March 8, 2013 3:38:52 PM
Registered User
Joined: 12/31/2004
Posts: 18

i'm trying to get this to work. it can either plot as an indicator or i can rank  any ideas where my error is  tks in advance   marty

input price = close; 
input length = 76; 
input RiskFreeReturn = 4; 
 
def ROC = if price[length] != 0 then (price / price[length] - 1) * 100 
else 0; 
 
def Ri = 100*(price - Highest(price,length))/Highest(price,length); 
 
def UlcerX = sqrt(average( (Ri*Ri), length)); 
 
# plot RiskFree = RiskFreeReturn; 
 
plot UPI = round((ROC - RiskFreeReturn)/sqrt(average( (Ri*Ri), length)),1); 
Bruce_L
Posted : Friday, March 8, 2013 3:49:56 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138

At least with a length of 76, the resulting Indicator Formula is too long and slow to be practical or post in the forums.



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
mar955
Posted : Friday, March 8, 2013 4:11:53 PM
Registered User
Joined: 12/31/2004
Posts: 18

Bruce, I asked tech support and they said i should ask a trainer

Bruce_L
Posted : Friday, March 8, 2013 4:14:28 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138

Yes, this is the correct place to ask the question. I created the formula and tested it. The resulting formula is too long and slow to be practical or post in the forums when the length is set to 76. That means I cannot help you create the formula unless we use a shorter period.



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
mar955
Posted : Friday, March 8, 2013 10:31:18 PM
Registered User
Joined: 12/31/2004
Posts: 18

Bruce, I mis understood your answer.  I can do a smaller period.  The 76 is where I want the ranking to start.   I can use 50 or any time frame. If 50 doesn't work. Try 40

thanks again. Marty

Bruce_L
Posted : Monday, March 11, 2013 12:29:15 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138

If I'm understanding your description correctly (which is not guaranteed), then you could use the following formula for a length of 50 and a RiskFreeReturn of 4:

(100 * (C / C50 - 1.04) / (((C / MAXH50 - 1) ^ 2 + (C1 / MAXH50.1 - 1) ^ 2 + (C2 / MAXH50.2 - 1) ^ 2 + (C3 / MAXH50.3 - 1) ^ 2 + (C4 / MAXH50.4 - 1) ^ 2 + (C5 / MAXH50.5 - 1) ^ 2 + (C6 / MAXH50.6 - 1) ^ 2 + (C7 / MAXH50.7 - 1) ^ 2 + (C8 / MAXH50.8 - 1) ^ 2 + (C9 / MAXH50.9 - 1) ^ 2 + (C10 / MAXH50.10 - 1) ^ 2 + (C11 / MAXH50.11 - 1) ^ 2 + (C12 / MAXH50.12 - 1) ^ 2 + (C13 / MAXH50.13 - 1) ^ 2 + (C14 / MAXH50.14 - 1) ^ 2 + (C15 / MAXH50.15 - 1) ^ 2 + (C16 / MAXH50.16 - 1) ^ 2 + (C17 / MAXH50.17 - 1) ^ 2 + (C18 / MAXH50.18 - 1) ^ 2 + (C19 / MAXH50.19 - 1) ^ 2 + (C20 / MAXH50.20 - 1) ^ 2 + (C21 / MAXH50.21 - 1) ^ 2 + (C22 / MAXH50.22 - 1) ^ 2 + (C23 / MAXH50.23 - 1) ^ 2 + (C24 / MAXH50.24 - 1) ^ 2 + (C25 / MAXH50.25 - 1) ^ 2 + (C26 / MAXH50.26 - 1) ^ 2 + (C27 / MAXH50.27 - 1) ^ 2 + (C28 / MAXH50.28 - 1) ^ 2 + (C29 / MAXH50.29 - 1) ^ 2 + (C30 / MAXH50.30 - 1) ^ 2 + (C31 / MAXH50.31 - 1) ^ 2 + (C32 / MAXH50.32 - 1) ^ 2 + (C33 / MAXH50.33 - 1) ^ 2 + (C34 / MAXH50.34 - 1) ^ 2 + (C35 / MAXH50.35 - 1) ^ 2 + (C36 / MAXH50.36 - 1) ^ 2 + (C37 / MAXH50.37 - 1) ^ 2 + (C38 / MAXH50.38 - 1) ^ 2 + (C39 / MAXH50.39 - 1) ^ 2 + (C40 / MAXH50.40 - 1) ^ 2 + (C41 / MAXH50.41 - 1) ^ 2 + (C42 / MAXH50.42 - 1) ^ 2 + (C43 / MAXH50.43 - 1) ^ 2 + (C44 / MAXH50.44 - 1) ^ 2 + (C45 / MAXH50.45 - 1) ^ 2 + (C46 / MAXH50.46 - 1) ^ 2 + (C47 / MAXH50.47 - 1) ^ 2 + (C48 / MAXH50.48 - 1) ^ 2 + (C49 / MAXH50.49 - 1) ^ 2) ^ .5)) \ 1

And the following formula for a length of 40 and a RiskFreeReturn of 4:

(100 * (C / C40 - 1.04) / (((C / MAXH40 - 1) ^ 2 + (C1 / MAXH40.1 - 1) ^ 2 + (C2 / MAXH40.2 - 1) ^ 2 + (C3 / MAXH40.3 - 1) ^ 2 + (C4 / MAXH40.4 - 1) ^ 2 + (C5 / MAXH40.5 - 1) ^ 2 + (C6 / MAXH40.6 - 1) ^ 2 + (C7 / MAXH40.7 - 1) ^ 2 + (C8 / MAXH40.8 - 1) ^ 2 + (C9 / MAXH40.9 - 1) ^ 2 + (C10 / MAXH40.10 - 1) ^ 2 + (C11 / MAXH40.11 - 1) ^ 2 + (C12 / MAXH40.12 - 1) ^ 2 + (C13 / MAXH40.13 - 1) ^ 2 + (C14 / MAXH40.14 - 1) ^ 2 + (C15 / MAXH40.15 - 1) ^ 2 + (C16 / MAXH40.16 - 1) ^ 2 + (C17 / MAXH40.17 - 1) ^ 2 + (C18 / MAXH40.18 - 1) ^ 2 + (C19 / MAXH40.19 - 1) ^ 2 + (C20 / MAXH40.20 - 1) ^ 2 + (C21 / MAXH40.21 - 1) ^ 2 + (C22 / MAXH40.22 - 1) ^ 2 + (C23 / MAXH40.23 - 1) ^ 2 + (C24 / MAXH40.24 - 1) ^ 2 + (C25 / MAXH40.25 - 1) ^ 2 + (C26 / MAXH40.26 - 1) ^ 2 + (C27 / MAXH40.27 - 1) ^ 2 + (C28 / MAXH40.28 - 1) ^ 2 + (C29 / MAXH40.29 - 1) ^ 2 + (C30 / MAXH40.30 - 1) ^ 2 + (C31 / MAXH40.31 - 1) ^ 2 + (C32 / MAXH40.32 - 1) ^ 2 + (C33 / MAXH40.33 - 1) ^ 2 + (C34 / MAXH40.34 - 1) ^ 2 + (C35 / MAXH40.35 - 1) ^ 2 + (C36 / MAXH40.36 - 1) ^ 2 + (C37 / MAXH40.37 - 1) ^ 2 + (C38 / MAXH40.38 - 1) ^ 2 + (C39 / MAXH40.39 - 1) ^ 2) ^ .5)) \ 1



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Users browsing this topic
Guest-1

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.