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.
|