Discussions
»
Innovative Market Analysis
»
Online Help
»
MetaStock FAQ
»
Expert Advisor: How to eliminate error messages in the Expert Advisor
Rank: Advanced Member
Groups: Registered, Registered Users Joined: 3/19/2005(UTC) Posts: 2,995
Was thanked: 14 time(s) in 10 post(s)
|
How to eliminate error messages in the Expert Advisor
I have a 200-day EMA commentary in the Expert Advisor. The security that I loaded contains less than 200 bars of data. It results in this error message: *Error* Function did not return a value. How do I eliminate this error message?
writeif(lastvalue(cum(1))>200,"The 200 day EMA is at writeval(mov(c,200,e))","")
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.
|
1 user thanked StorkBite for this useful post.
|
|
|
Rank: Newbie
Groups: Registered Users, Subscribers Joined: 11/14/2014(UTC) Posts: 1
|
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.
__________________________
dhoom
|
|
|
|
Users browsing this topic |
Guest (Hidden)
|
Discussions
»
Innovative Market Analysis
»
Online Help
»
MetaStock FAQ
»
Expert Advisor: How to eliminate error messages in the Expert Advisor
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.