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

Notification

Icon
Error

Options
Go to last post Go to first unread
kentai  
#1 Posted : Sunday, June 12, 2005 5:51:43 AM(UTC)
kentai

Rank: Newbie

Groups: Registered, Registered Users
Joined: 6/12/2005(UTC)
Posts: 2

I would like to eliminate those error message in my Expert Advisor Commentary. Is there a way to do it, I tried a few methods, but it failed. For example, I have added in a 200-days EMA commentary in the Expert Advisor Commentary. The security that I loaded is less than 200 bars of data. It comes out with an error message (*Error* Function did not return a value), how do I eliminate this error message?
wabbit  
#2 Posted : Sunday, June 12, 2005 6:15:27 AM(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)
One way is to use something along the lines of: writeif(lastvalue(cum(1))>200,"The 200 day EMA is at writeval(mov(c,200,e))","") Hope this helps. wabbit :D [edited bit] Actually you dont need the last set of quotes (the return if false part) but I include them anyway, it helps the readability as I already have in my mind that for every IF statement there is going to be a TRUE and FALSE return. If you are struggling for space in your commentary, use the abbreviated form: writeif(lastvalue(cum(1))>200,"200 EMA: writeval(mov(c,200,e))")
wabbit  
#3 Posted : Sunday, June 12, 2005 6:22:32 AM(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)
Sorry, I should also have explained the code... The code uses the writeif function to check the condition of lastvalue(cum(1))>200 which counts the number of bars in the open chart. If the last value of this is greater than 200 (then there must be more than 200 bars of data in the chart) This makes the expression TRUE and the statement is printed to the screen with the value of the 200 day EMA. If there is less than 200 bars in the chart the output is nothing. Hope that makes sense. wabbit :D
wabbit  
#4 Posted : Sunday, June 12, 2005 6:30:23 AM(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)
Patrick, This is another one of those occassions where the logic in MS has me perplexed. We should be able to do something along the lines of: writeif(isdefined(mov(c,200,e)),"The 200 day EMA is at writeval(mov(c,20,e))","") without generating errors, but it does generate errors due that awry logic discussed already on other forum threads. Any chance of reviewing this one in future versions? wabbit :D
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.