Hello Ton, You are correct and you should initialize the text variable. However your solution doesn't work in a my real time application. Of course, if your simpler solution works for you should use it.
I am absolutely delighted with the Say() as it lets me focus on and do other things while trading or running bar-Playback simulations. I don't have to sit and stare (waste time and get cross-eyed) at the screen to see at what price my order triggered or what transient error passed, the say() output is slow and lets you catch it all. For me this is simply utilizing my senses more effectively. It lets me work under much less intense (normally needed to catch transient events) conditions. With a little innovation the Say() can help you create a much more efficient working environment. Thanks again Tomasz :-) best regards, herman -----Original Message----- From: [email protected] [mailto:[EMAIL PROTECTED] Behalf Of Ton Sieverding Sent: December 27, 2006 3:48 AM To: [email protected] Subject: Re: [amibroker] Example code for using Say() I have three problems with this code Herman. My first problem is that it doesn't give me a Buy or Sell sound. So for me it does not work properly. Secondly, the variable Text will create an error in case there is no Buy or Sell because it has not been initialized. I would start the code with 'Text = "";'. And thirdly, why not keeping things simple ( KISS ) ? As I told you, the following works fine : if (LastValue(Buy)) Say("Buy"); if (LastValue(Sell)) Say("Sell"); I am probably not seeing the problems that you're seeing ... Ton. ----- Original Message ----- From: Herman To: [email protected] Sent: Tuesday, December 26, 2006 9:40 PM Subject: [amibroker] Example code for using Say() Sorry, here's a small change to the code - I should have tested it before posting! if(LastValue(Buy)) Text =" Buy, at, "+NumToStr(BuyPrice,1.2); else if(LastValue(Short)) Text ="Short, at, "+NumToStr(ShortPrice,1.2);; PrevText = StaticVarGetText("PrevText"); if( StrLeft(Text,5) != StrLeft(PrevText,5) ) { Say( Text ); StaticVarSetText("PrevText", text); } ---------------------------------------------------------------------------- just FYI I use this type of code in Real-time trading and it seems to wokr just fine: if(LastValue(Buy)) Text = "Buy, at, "+NumToStr(BuyPrice,1.2); else if(LastValue(Short)) Text ="Short, at, "+NumToStr(ShortPrice,1.2);; PrevText = StaticVarGetText("PrevText"); if( Text != PrevText ) { Say( Text ); StaticVarSetText("PrevText", text); } -----Original Message----- From: [email protected] [mailto:[EMAIL PROTECTED] Behalf Of Herman Sent: December 26, 2006 2:51 PM To: [email protected] Cc: [EMAIL PROTECTED] Subject: RE: [amibroker] Say message interruption Perhaps TJ can add a msg queue or a SayStatus() command so that we can do the queueing ourself. You may be able to prevent repeats (using Static variables) and prevent calling Say() to fast, you could insert an automatically minimum call interval, using GetPerformanceCounter() or getStatus("RedrawAction"), that is proportional to the number of characters in your message. best regards, herman -----Original Message----- From: [email protected] [mailto:[EMAIL PROTECTED] Behalf Of Dale Brubaker Sent: December 26, 2006 2:09 PM To: [email protected] Cc: [EMAIL PROTECTED] Subject: [amibroker] Say message interruption I love the new Say(text) command in 4.89 Beta, but often the message is cut off (apparently by the next pass through the AFL code) before it can be completely "uttered". Has anyone else seen this problem and figured out how to "buffer" it? Thanks, Dale
