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

Notification

Icon
Error

Options
Go to last post Go to first unread
yonyon191719  
#1 Posted : Sunday, December 9, 2018 10:33:25 PM(UTC)
yonyon191719

Rank: Newbie

Groups: Registered, Registered Users, Subscribers
Joined: 11/29/2018(UTC)
Posts: 2

Hello,

I'm using barssince() with a condition I developed.

For stocks, usually which does not exist more than 2 years, sometimes the condition never happened before. In this case, barssince() is problematic, and my whole formula is corrupted, and doesn't plot anything.

I want to check if barssince() comes back with a real value, or a N/A value. Or make some try-catch to catch a case in which barssince() failed.

How can I do it?

Thanks

Edited by user Sunday, December 9, 2018 10:36:06 PM(UTC)  | Reason: Not specified

MS Support  
#2 Posted : Monday, December 10, 2018 3:32:57 PM(UTC)
MS Support

Rank: Advanced Member

Groups ready for retrieval: Moderators, Registered, Registered Users, Subscribers
Joined: 10/8/2010(UTC)
Posts: 1,934

Thanks: 85 times
Was thanked: 154 time(s) in 150 post(s)
Originally Posted by: yonyon191719 Go to Quoted Post

Hello,

I'm using barssince() with a condition I developed.

For stocks, usually which does not exist more than 2 years, sometimes the condition never happened before. In this case, barssince() is problematic, and my whole formula is corrupted, and doesn't plot anything.

I want to check if barssince() comes back with a real value, or a N/A value. Or make some try-catch to catch a case in which barssince() failed.

How can I do it?

Thanks

Hello,

Unfortunately, if the condition is never true within the data sample there is not a way to work around the problem and the formula logic would need to be reworked if possible. There are functions IsDefined and IsUndefined but they also require a condition to have been true at least once within the data sample analyzed.

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.