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

Notification

Icon
Error

Options
Go to last post Go to first unread
marketwatch  
#1 Posted : Saturday, February 14, 2009 3:04:34 PM(UTC)
marketwatch

Rank: Newbie

Groups: Registered, Registered Users
Joined: 3/19/2006(UTC)
Posts: 8
Location: Analyst

Good day all,

I have an issue with the above functions working together. I have a custom formula that determines if a trend exists or not. If not the formula equals 5. I can accurately determine how long the market has been flat (e.g 9 days) using BarsSince() but when I try to ascertain the closing price when no trend existed, using ValueWhen, it fails to give the correct value. And if I 'page' back in time in the Expert, the length of time the market was flat decreases accordingly but the closing price changes each time. Perhaps I have gone 'code' blind and someone can easily see the errors of my ways. If so let me know. Or perhas there is a better way to achieve my goals.

In the Expert I have;

writeif( Fml( "MT-Trend") = 5, "<Name> is not trending over the medium term it is flat. It has been flat for the past writeval( BarsSince( Fml( "MT-Trend") <> 5 ),0.0) day(s). The closing price at that time was writeval(valuewhen(1, BarsSince( Fml( "MT-Trend") <> 5 ),c),3.4)", ")

Thank you in advance.

Steve



wabbit  
#2 Posted : Sunday, February 15, 2009 7:02:05 PM(UTC)
wabbit

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers, Unverified Users
Joined: 10/28/2004(UTC)
Posts: 3,111
Location: Perth, Western Australia

Was thanked: 16 time(s) in 16 post(s)
Hi Steve,

Try this:

Code:
writeval(
valuewhen(1, Fml("MT-Trend") <> 5 ), c)
,3.4)


Note: the BarsSince() was the part that was causing the (logic) error and has been removed.


Hope this helps.

wabbit [:D]

marketwatch  
#3 Posted : Monday, February 16, 2009 6:17:41 AM(UTC)
marketwatch

Rank: Newbie

Groups: Registered, Registered Users
Joined: 3/19/2006(UTC)
Posts: 8
Location: Analyst

Thanks for spotting my error wabbit. [:$]
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.