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

Notification

Icon
Error

Options
Go to last post Go to first unread
verybadboy  
#1 Posted : Wednesday, November 2, 2005 6:08:47 AM(UTC)
verybadboy

Rank: Newbie

Groups: Registered, Registered Users
Joined: 11/2/2005(UTC)
Posts: 7

my formula is for example: (JUST EXAMPLE) SUM(IF(C>H, H, 0),20)-C The formula will become error since C can not be greater than H in each period and the left ¡°c¡± in SUM() is not equal in period to the right ¡°c¡± My objective is that I want the left ¡°c¡± to be the same period of the right ¡°c¡± i.e. for one period of sum(¡­..), I should have only one and the same period of ¡°c¡±(but not as in the formula 20C in 20 periods ago) to compare with the 20 different H in all 20 periods ago. In brief, I just want the left ¡°c¡± to be the same as right ¡°c¡± in the same period. I have tried the following methods before but all fail, e.g. X:=VALUEWHEN(1, CUM(1), C) SUM(IF(X>H, H, 0),20)-C BUT IT FAILS AS X IS NOT EQUAL TO RIGHT "C" IN THE SAME PERIOD BUT EQUAL TO H i have also tried the alternative method, e.g. 0+IF(C>REF(H,-1), REF(H,-1), 0)+IF(C>REF(H,-2), REF(H,-2), 0)+...... BUT I WANT TO ADD UP TO 200 PERIODS BUT THE FORMULA BOX HAS CHARACTERS LIMIT SO IT FAILS TOO
verybadboy  
#2 Posted : Wednesday, November 2, 2005 2:43:51 PM(UTC)
verybadboy

Rank: Newbie

Groups: Registered, Registered Users
Joined: 11/2/2005(UTC)
Posts: 7

THANK YOU VERY MUCH IF ANY ONE CAN HELP TO SOLVE THIS PROBLEM, THANK YOU!!!
StorkBite  
#3 Posted : Wednesday, November 2, 2005 4:00:39 PM(UTC)
StorkBite

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 3/19/2005(UTC)
Posts: 2,995

Was thanked: 14 time(s) in 10 post(s)
Hey VBB- Welcome to the forum! When you get a sec, please have a look at the forum rules. We discourage against using vague subjects such as "Urgent help"; bumping 8 hours later; and, using all capital letters. Regarding your question, post the code that you need 'urgent' help with. In your example, you might be on the right track with something like you already posted: IF(C>ref(H,-1), C, ref(H,-1). If the current close is greater than the high one period ago, then use the current close, else use the high one period ago.
verybadboy  
#4 Posted : Wednesday, November 2, 2005 4:22:22 PM(UTC)
verybadboy

Rank: Newbie

Groups: Registered, Registered Users
Joined: 11/2/2005(UTC)
Posts: 7

but if i want to add up to 200 periods like, 0+IF(C>REF(H,-1), REF(H,-1), 0)+IF(C>REF(H,-2), REF(H,-2), 0)+...... +IF(C>REF(H, -200), REF(H, -200), 0)... the indicator builder has "characters limit" and i can not add so many words and characters........ besides it is troublesome too.... however, thank you first
StorkBite  
#5 Posted : Wednesday, November 2, 2005 5:08:29 PM(UTC)
StorkBite

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 3/19/2005(UTC)
Posts: 2,995

Was thanked: 14 time(s) in 10 post(s)
Check out the PREV function in the User's Manual or in the Formula Primer. Maybe something like this? x:=IF(C>REF(H,-1), REF(H,-1), 0) + PREV; x;
Jose  
#6 Posted : Thursday, November 3, 2005 3:59:54 AM(UTC)
Jose

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 1/19/2005(UTC)
Posts: 1,065
Location: Koh Pha-Ngan, Earth

Was thanked: 2 time(s) in 2 post(s)
... or perhaps [code:1:10833396fa]Cum(If(C>Ref(H,-1),Ref(H,-1),0))[/code:1:10833396fa] for the same without the PREV function. jose '-)
verybadboy  
#7 Posted : Thursday, November 3, 2005 6:16:30 AM(UTC)
verybadboy

Rank: Newbie

Groups: Registered, Registered Users
Joined: 11/2/2005(UTC)
Posts: 7

thank you for your help first, but if use PREV and CUM, the "C" itself becomes variable too which i don't want to see, your formula is sth like this x:=IF(C>REF(H,-1), REF(H,-1), 0) + IF(REF(C,-1)>REF(H,-2), REF(H,-2), 0)+ PREV; x; but my objective is like this: IF(C>REF(H,-1), REF(H,-1), 0) + IF( C >REF(H,-2), REF(H,-2), 0)+................. i really appreciate your help!
Jose  
#8 Posted : Thursday, November 3, 2005 9:43:02 AM(UTC)
Jose

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 1/19/2005(UTC)
Posts: 1,065
Location: Koh Pha-Ngan, Earth

Was thanked: 2 time(s) in 2 post(s)
To compare previous Highs against the chart's last Close: [code:1:256d3a5d14]LastCl:=LastValue(C); Cum(If(LastCl>Ref(H,-1),Ref(H,-1),0)) [/code:1:256d3a5d14] To lock the Close to the current bar's value, and compare it to previous Highs: [code:1:256d3a5d14]Cum(If(LastValue(C+PREV-PREV)>Ref(H,-1),Ref(H,-1),0)) [/code:1:256d3a5d14] jose '-)
verybadboy  
#9 Posted : Thursday, November 3, 2005 2:26:08 PM(UTC)
verybadboy

Rank: Newbie

Groups: Registered, Registered Users
Joined: 11/2/2005(UTC)
Posts: 7

thank you everyone for your help, all of you are so kind and really helpful. Besides i want to say thousands of thanks to JOSE and your formula solves my obessive problem and wish you good luck in the future!
Users browsing this topic
Guest (Hidden)
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.