[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [amibroker] Help on Say() in loop



PureBytes Links

Trading Reference Links

try this function:


function SayOnce( text )

{

   if( StaticVarGetText("lastsaidtext") != text )

   {

      Say( text );

      StaticVarSetText("lastsaidtext", text );

   }

}


For tips on developing Real-Time Auto-Trading systems visit:

http://www.amibroker.org/userkb/


Saturday, June 7, 2008, 5:28:19 AM, you wrote:


>

Herman,


But that would not serve the purpose of limiting the output .....

rather I was actually looking to increase the limit to 120 sec.


But shouldn't the code give the output at the first instance...irrespective of the timer?


I think there is some modification needed in the code in function(saynottoooften) when used alongwith this loop.


Regards,


Raajesh



((((( Raajesh Jariwala )))))



--- On Sun, 8/6/08, Herman <psytek@xxxxxxxx> wrote:


From: Herman <psytek@xxxxxxxx>

Subject: Re: [amibroker] Help on Say() in loop

To: "Raajesh" <amibroker@xxxxxxxxxxxxxxx>

Date: Sunday, 8 June, 2008, 2:40 AM



You can try setting the elapsed time to 1 second instead of 60...


herman


For tips on developing Real-Time Auto-Trading systems visit:

http://www.amibroke r.org/userkb/


Saturday, June 7, 2008, 4:55:45 AM, you wrote:


>

Thanks herman for the quick response.


The code does not generate the sound as it is......but when i replace saynotoooften with only say, it works.


Is there any problem with regards to using the limited timer function?


Regards,


Raajesh



--- On Sun, 8/6/08, Herman <psytek@xxxxxx ca> wrote:


From: Herman <psytek@xxxxxx ca>

Subject: Re: [amibroker] Help on Say() in loop

To: "Raajesh" <amibroker@xxxxxxxxx ps.com>

Date: Sunday, 8 June, 2008, 1:42 AM



Untested. If you want to hear a message at the "selected" bar, i.e. where the cursor is you don't need a loop. Note that the complex conditions must be exclusive, else you will onlt hear the first one that is true.


good luck,

herman


function SayNotTooOften( text, Minperiod )

{

    elapsed = GetPerformanceCount er() / 1000;

    Lastelapsed = Nz( StaticVarGet( "lastsaytime" ) );

    if ( elapsed - Lastelapsed > Minperiod )

    {

        StaticVarSet( "lastsaytime" , elapsed );

        Say( text );

    }

}


if ( SelectedValue( cond1 AND cond2 ) )

    text = "Fresh Buy on " + FullName();

else if ( SelectedValue( Cond17 AND cond3 AND cond4 ) )

    text = "Strong Buy on " + FullName();

else if ( SelectedValue( Cond17 AND cond3 ) )

    text = "Buy on " + FullName();

else if ( SelectedValue( Cond17 AND cond5 ) )

    text = "watch buy On " + FullName();

else text = "";


SayNotTooOften( text, 60 );




For tips on developing Real-Time Auto-Trading systems visit:

http://www.amibroke r.org/userkb/


Saturday, June 7, 2008, 3:56:55 AM, you wrote:


>

Friends,


Can any body please correct my following code?


text = O;

for (i=1; i < BarCount; i++)

{

   if (cond1[i] AND cond2[i])

   {

    text = "Fresh Buy on "+ FullName();

   } 

    if (Cond17[i] AND cond3[i] AND cond4[i])

   {

    text = "Strong Buy on "+FullName() ;

   }

    if (Cond17[i] AND cond3[i])

   {

    text = "Buy on "+FullName() ;

   }

    if (Cond17[i] AND cond5[i])

   {

    text = "watch buy On "+FullName() ;

  }

   else;

}


function SayNotTooOften( text, Minperiod ) 

   elapsed=GetPerforma nceCounter( )/1000; 

   Lastelapsed = Nz( StaticVarGet( "lastsaytime" ) ); 


  if( elapsed - Lastelapsed > Minperiod ) 

   { 

     StaticVarSet( "lastsaytime" , elapsed ); 

     

     Say( text ); 

   } 

   


SayNotTooOften( text, 60 );


I keep hearing the last line irrespective of where I point the cursor. There seems to be some problem with my looping code.


Thanks and regards,


Raajesh





Bring your gang together. Do your thing. Find your favourite Yahoo! Group.  




Download prohibited? No problem. CHAT from any browser, without download.  




From Chandigarh to Chennai - find friends all over India. Click here.  

__._,_.___

Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

For other support material please check also:
http://www.amibroker.com/support.html




Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___