{ PSS_I_TellCLose Example of using the PSS EasyLanguage Speak Extension: Tell the closing Price and Time of a bar (C)Copyright, 2003-2004, B.Eichberger from Professional Software Solutions(PSS), pss@pobox.com } input: StopSpeak(false), { True if spkeaing should be disabled } EveryXBars(1); { in case not every bar should be spoken } vars: bSkip(false), { True if bar should be skipped } bRealtime(false), { True if bar is NEW in realtime } nBar0(0), { First bar added to chart after initial log - realtime } nHr(0), { Hour of current bar } nMi(0), { Minute of current bar } nRetSpeak(0), { Speak return code } txtSpeak(""); { Text to be spoken } {====== Declare PSS DLL Functions ============} DefineDLLFunc: "PSS_F1.DLL", int , "PSS_Speak", LPSTR, LPSTR, LONG; DefineDLLFunc: "PSS_F1.DLL", int , "PSS_IfRealtime", LONG, LONG; {====== Check if new has been added in RealTime ============} bRealtime = FALSE; nBar0 = PSS_IfRealtime(barnumber,10); if Barnumber >= nBar0 and nBar0 > 0 then bRealtime = TRUE; {====== Get Hour and Minute of new bar ============} nHr = IntPortion(Time/100); nMi = Mod(Time,100); {print("Bar=",barnumber," Time=",Time," Hr=",numtostr(nHr,0)," Mi=",nMi," nBar0=",nBar0," RT=",bRealtime);} {====== Check if speaking is enabled ============} if StopSpeak then begin PSS_Speak("Stop",txtSpeak,CustomerID); end else begin {====== Check if speaking should be skipped for this bar ============} bSkip = FALSE; if bRealtime = false then bSkip = TRUE; if EveryXBars > 1 and Mod(barnumber,EveryXBars) = 0 then bSkip = false; if bSkip = false then begin {====== Build text to be spoken ============} txtSpeak = "Bar " + numtostr(barnumber,0) + " closed at " + numtostr(close,2) + " at " + numtostr(nHr,0) + "hours and " + numtostr(nMi,0) + " Minutes"; {====== Stop/cut previous sentence - in case still running ============} PSS_Speak("Stop",txtSpeak,CustomerID); {====== Send text to be spoken ============} nRetSpeak = PSS_Speak("Speak",txtSpeak,CustomerID); if (nRetSpeak < 0) then print("Speak Error: ",nRetSpeak:5:0); {====== Show spoken text also Print Log (View/Output Bar/Print Log) ============} print(txtSpeak); end; end; Plot1(barnumber,"BarNumber")