coding help

#3
KelvinHand,
i got the solution from another forum.
here is the code
// Note that if you get a sell within the reject period of the Buy

// it will be missed the first time. To fix this you have to modify

// the SayNotTooOften function.



function SayNotTooOften( text, Minperiod )

{

elapsed = GetPerformanceCounter() / 1000;

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



if ( elapsed - Lastelapsed > Minperiod )

{

StaticVarSet( "lastsaytime", elapsed );

Say( text );

}

}

// system source unknown…

Buy = Cross( MA( C, 13 ), MA( C, 15 ) );

Sell = Cross( MA( C, 15 ), MA( C, 13 ) );

Plot( MA( C, 13 ), "Fast 13 Periods MA", 2, 1 ); // White

Plot( MA( C, 15 ), "Slow 15 Periods MA", 4, 1 ); // Red

Plot( C, "", 1, styleCandle );



ManualBuy = ParamTrigger( "Manual Buy", "NOW" );

LastBuy = LastValue( Buy ) OR MAnualBuy;



if ( LastBuy )

SayNotTooOften( "Buy", 5 ); // Will not repeat voice output faster than once in 5-seconds



ManualSell = ParamTrigger( "Manual Sell", "NOW" );



LastSell = LastValue( Sell ) OR MAnualSell;



if ( LastSell )

SayNotTooOften( "Sell", 5 );
 

Similar threads