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

Notification

Icon
Error

Options
Go to last post Go to first unread
Bulli  
#1 Posted : Thursday, November 17, 2005 9:57:04 PM(UTC)
Bulli

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 9/26/2005(UTC)
Posts: 185
Location: Brazil

Hi, I am using this trend line which works very well, I should say. I do not know the programmer to give him credit for it, thanks to him w[censored]ver he is! The problem I am having is that I am unable to get the last value to be as what is shown when you hover the mouse over the indicator! I tired lastvalue() over all the variations that appears in the function list but it did not work. I would appreciate any help. ----------8<------------------ pv:= Input("VeryLong=4,Long=3,Med=2,Short=1",1,4,3); pp:= LastValue(If(pv=4,4,If(pv=3,2,If(pv=2,1,0.5)))); r0:= If(MP()>=Ref(MP(),-1),ATR(1),0); r1:= Log(If(r0>0,ATR(1),HIGH)/HIGH); r2:= Cum(r1)/Max(1,Cum(If(r0>0,1,0))); r3:= LastValue(100*Exp(LastValue(r2)))*pp; r4:= LastValue(PeakBars(2,H,r3))-LastValue(PeakBars(1,H,r3)); r5:= (LastValue(Peak(1,H,r3))-LastValue(Peak(2, H,r3)))/r4; {slope} r6:= LastValue(Peak(2, H,r3))+(r5*(Cum(1)-LastValue(Cum(1)- PeakBars(2,H,r3)))); r7:= If(Cum(1) <LastValue(Cum(1)-PeakBars(2,H,r3)),BarsSince(Cum(1)>=LastValue(Cum(1)-PeakBars( 2,H,r3))),r6); s0:= If(MP()<=Ref(MP(),-1),ATR(1),0); s1:= Log(If(s0>0,ATR(1),LOW)/LOW); s2:= Cum(s1)/Max(1,Cum(If(s0>0,1,0))); s3:= LastValue(100*Exp(LastValue(s2)))*pp; s4:= LastValue(TroughBars(2,L,s3))-LastValue(TroughBars(1,L,s3)); s5:= (LastValue(Trough(1,L,s3))-LastValue(Trough(2,L,s3)))/s4; {slope} s6:= LastValue(Trough(2,L,s3))+(s5*(Cum(1)-LastValue(Cum(1)-TroughBars(2,L,s3)))); s7:= If(Cum(1)<LastValue(Cum(1)-TroughBars(2,L,s3)),BarsSince(Cum(1)>=LastValue(Cum(1 )-TroughBars(2, L,s3))),s6); r7;s7; ----------8<------------------ Regards, Bulli ;)
Patrick  
#2 Posted : Friday, November 18, 2005 9:39:50 PM(UTC)
Patrick

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 9/8/2004(UTC)
Posts: 2,266

Was thanked: 1 time(s) in 1 post(s)
Quote:
The problem I am having is that I am unable to get the last value to be as what is shown when you hover the mouse over the indicator!
Sorry Bulli, not trying to be a pain but I did not understand the question/issue. Patrick :mrgreen:
Bulli  
#3 Posted : Friday, November 18, 2005 10:18:07 PM(UTC)
Bulli

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 9/26/2005(UTC)
Posts: 185
Location: Brazil

Hi Partik, A picture is worth a thousand word; please take a look at the foto. I need to find out the value in blue circle to compare it to the close price! The formula should be something like this (I guess) I need the formula for Expert Advisor: This is what I tried but I am getting the same result from both: 16.25 writeval( Fml( "Bulli Trend I"),0.2 ) writeval(lastvalue( Fml( "Bulli Trend I")),0.2) among all other variations that appears when you add the indicator: Like "PP", "R1", "S1" all of them. But if you take a look at the foto: the value is 19.51 How can I get this 19.51? this is my question Get the picture? Thanks, Bulli ;)
Patrick  
#4 Posted : Friday, November 18, 2005 10:29:54 PM(UTC)
Patrick

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 9/8/2004(UTC)
Posts: 2,266

Was thanked: 1 time(s) in 1 post(s)
Ultimately I don't what your setup is so don't be offended if what I'm going to say is obvious. When you write a formula ( an indicator ) it willl only return the last indicator value ... For Example if the formula for the indicator called "Bulli Trend I" is :
Originally Posted by: VeryLong=4,Long=3,Med=2,Short=1",1,4,3) Go to Quoted Post
You will notice that it returns 2 values. r7 and s7 ... Because s7 is last when the Indicator is used in a fml call only that value is passed ... Could this be the problem? Ultimately I think you have the right formula I can't see anything obviously wrong with your setup ... Let me know if you have more info or if that was completely off topic :D Patric
Bulli  
#5 Posted : Friday, November 18, 2005 10:45:39 PM(UTC)
Bulli

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 9/26/2005(UTC)
Posts: 185
Location: Brazil

Yes, I know about the last value. But this is exactly the problem: when you hover the mouse over an indicator it should give you the last value if you point at the last point of it. This value from the mouse is not equal to the last value in the result of the formula. Tooltip value: 19.51 but the outcome of the formula is: 16.25 Well if you have time can you do like this: Add this trendline to a chart (anyone well do) Get the last value from the formula and compare the result from the tooltip; They do not match! and this is my problem #-o Thanks, Bulli
Bulli  
#6 Posted : Friday, November 18, 2005 10:51:19 PM(UTC)
Bulli

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 9/26/2005(UTC)
Posts: 185
Location: Brazil

The following two formulas give the same result, have tried that also, (including from S0 up till S7 and R0 up till R7, but I still cannot match the 19.51 which is the value I want) writeval( Fml( "Bulli Trend I") ) writeval(FmlVar("Bulli Trend I","S7") ) Thanks for your time, Bulli ;)
Patrick  
#7 Posted : Friday, November 18, 2005 10:51:49 PM(UTC)
Patrick

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 9/8/2004(UTC)
Posts: 2,266

Was thanked: 1 time(s) in 1 post(s)
I just tested it as directed above and it works fine on my machine ... What version of Meta do you have?
Patrick  
#8 Posted : Friday, November 18, 2005 11:04:05 PM(UTC)
Patrick

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 9/8/2004(UTC)
Posts: 2,266

Was thanked: 1 time(s) in 1 post(s)
Here is my chart Test 2 is using LastValue of test UserPostedImage
Bulli  
#9 Posted : Friday, November 18, 2005 11:09:31 PM(UTC)
Bulli

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 9/26/2005(UTC)
Posts: 185
Location: Brazil

Can you show me one like this foto in your system. Thanks, Bulli ;)
Patrick  
#10 Posted : Friday, November 18, 2005 11:40:39 PM(UTC)
Patrick

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 9/8/2004(UTC)
Posts: 2,266

Was thanked: 1 time(s) in 1 post(s)
Here you go ... There has to be something else : UserPostedImage
Patrick  
#11 Posted : Friday, November 18, 2005 11:44:06 PM(UTC)
Patrick

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 9/8/2004(UTC)
Posts: 2,266

Was thanked: 1 time(s) in 1 post(s)
I just realised [code:1:6fd594c0f7]s1:= Log(If(s0>0,ATR(1),LOW)/LOW); s2:= Cum(s1)/Max(1,Cum(If(s0>0,1,0))); s3:= LastValue(100*Exp(LastValue(s2)))*pp; s4:= LastValue(TroughBars(2,L,s3))-LastValue(TroughBars(1,L,s3)); s5:= (LastValue(Trough(1,L,s3))-LastValue(Trough(2,L,s3)))/s4; {slope} s6:= LastValue(Trough(2,L,s3))+(s5*(Cum(1)-LastValue(Cum(1)-TroughBars(2,L,s3)))); s7:= If(Cum(1)<LastValue(Cum(1)-TroughBars(2,L,s3)),BarsSince(Cum(1)>=LastValue(Cum(1 )-TroughBars(2, L,s3))),s6); r7;s7; [/code:1:6fd594c0f7] S7 is your last value, that's why you get twice the same thing ...
Bulli  
#12 Posted : Saturday, November 19, 2005 12:15:20 AM(UTC)
Bulli

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 9/26/2005(UTC)
Posts: 185
Location: Brazil

It is not that, our discussion made me figured it out, but I still need help. You see S7 & R7 are really giving the last value but only for Long: 3 in the indicator but I am using Short: 1 Now my question would be different: how can I get the same values when I am setting the indicator to 1? Thanks, Bulli ;)
Patrick  
#13 Posted : Saturday, November 19, 2005 1:04:07 AM(UTC)
Patrick

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 9/8/2004(UTC)
Posts: 2,266

Was thanked: 1 time(s) in 1 post(s)
Replace : [code:1:d47b2c565a] pv:= Input("VeryLong=4,Long=3,Med=2,Short=1",1,4,3); [/code:1:d47b2c565a] by : pv:= Input("VeryLong=4,Long=3,Med=2,Short=1",1,4,1); Patrick :mrgreen:
Bulli  
#14 Posted : Saturday, November 19, 2005 3:25:01 AM(UTC)
Bulli

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 9/26/2005(UTC)
Posts: 185
Location: Brazil

Thank you very much, now it works like a charm! =D> =D> =D> =D> Thanks, Bulli ;)
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.