Rank: Member
Groups: Registered, Registered Users, Subscribers Joined: 9/19/2009(UTC) Posts: 27
|
Sometimes I get an error with my indicator.
"The following error occured while calculating... blabla Period value out of valid range in WillR function()"
Ok I call it with a too short or a too long period. I know it ;-)
But I don't want to have this screen and to have a buggy indicator... So... Is it possible to test if the period value is ok before to call the indicator? I do not want to have this error message.
Is there a statement such "if" for that? what to test before?
Thanks! :)
|
|
|
|
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)
|
If it's for an indicator, use the Input() function to limit the upper and lower boundaries. If it's for use in MS not as an indicator, use an If() statement to check for the minimum and maximum length conditions, then wrap the entire expression in LastValue() to convert from a data array to an integer suitable for use in the non-dynamic function. If you want, you can use Min() and Max() to replace the If() but If() is easier for now.
wabbit [:D]
|
|
|
|
Rank: Member
Groups: Registered, Registered Users, Subscribers Joined: 9/19/2009(UTC) Posts: 27
|
Thanks Wabbit,
Another question ;-)
I take an example, that's more easy for me! MyAv := Mov(C, 300, E);
If I got "Period value out of valid range in Mov function()", will MyAv have a specific value? For example, -1? or undef or something else?
A value I could use to do an if()?
|
|
|
|
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)
|
Ploufplouf wrote:Thanks Wabbit,
Another question ;-)
I take an example, that's more easy for me! MyAv := Mov(C, 300, E);
If I got "Period value out of valid range in Mov function()", will MyAv have a specific value? For example, -1? or undef or something else?
A value I could use to do an if()?
Test your periods versus the number of bars loaded i.e. LastValue(Cum(1)). 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.