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

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



PureBytes Links

Trading Reference Links

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 = GetPerformanceCounter() / 1000;

    Lastelapsed = NzStaticVarGet"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.amibroker.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=GetPerformanceCounter()/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.  

__._,_.___

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

__,_._,___