Use of AlertType
Author: Oakwood
Creation Date: 11/11/2009 6:35 PM
profile picture

Oakwood

#1
I'm having trouble using the function AlertType. I'm using it in the following context:
CODE:
Please log in to see this code.


I get the error: 'int' does not contain a definition for AlertType. I did a search and couldn't find anybody who has used this function and the Language guide only gives one example. Anybody have any suggestions? Thanks.
profile picture

Eugene

#2
In
CODE:
Please log in to see this code.
, "a" is undefined:
CODE:
Please log in to see this code.

profile picture

Oakwood

#3
That doesn't work. (Actually, I had already declared a as an int already).
profile picture

Eugene

#4
Oops, you're right. I overlooked the totally incorrect usage of AlertType above. It doesn't make sense to compare one type (TradeType) with a very different (string). Should be:
CODE:
Please log in to see this code.

profile picture

Eugene

#5
P.S. Revisit the "AlertType Property" QuickRef entry, you should find a description and the list of possible values returned by this enum.
profile picture

Oakwood

#6
Got the same error message. I have reviewed the references and re-reviewed them, but they don't help me.
profile picture

Eugene

#7
You're getting the same error message because integer does not contain an AlertType property.

Replace the erroneous "a.AlertType" fragment with Alerts[i].
profile picture

Oakwood

#8
Thanks! The exact syntax is : if(Alerts[a].AlertType == TradeType.Cover)
I must say the documentation on this and other functions is pretty poor and far from intuitive.
I really appreciate your help.
profile picture

Eugene

#9
What is unclear in the documentation, that Microsoft haven't defined no AlertType property for their C# integer type? :)
profile picture

Oakwood

#10
That's a joke, right? Excuse me if I'm a little concrete and still a relative newbie to C. I was of course referring to WL-5's documentation of functions--WL-4 provides much clearer and more thorough explanations than WL-5. Except as a random monkey I don't think I could have ever derived the code based on the documentation in WL-5. Take a look at it if you haven't recently.
profile picture

Eugene

#11
Look, for whatever reason you were trying to fill an array. You define an iterator ("a", of integer type), and then you're trying to extract a property from the integer (number) that does not exist there.

Another error was in trying to compare TradeType with a string. Even though it's created by the Wealth-Lab's designer, TradeType is just another data type in C#. So you need to follow the language conventions. The QuickRef helps you with that. For example, the AlertType entry is very much clear in stating that AlertType is a TradeType, is enum, and lists all the 4 possible options.

Finally, take a look in the Alert.BasisPrice code -- an example there shows how to properly make the comparison you were trying to make.
profile picture

Oakwood

#12
Thanks.
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).