Dont understand why I cant here PlaySound()

Back to topics list To post a new topic, please log in or register
avatar
52
renzbub 2016.03.09 21:50
 

In the following Indicator I fail to see why I cant here the PlaySound sounfile ive assigned to the SoundFile object?

Also it appears to overun my CPU?

// Turning Pivot Alarms On/Off Input Variables
input string SoundFile = "alert.wav";

//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,  // size of input time series     (here it starts 1001 on 00:00 and continues)
                const int prev_calculated, // bars handled in previous call  (here it returns 0 on 00:00 and 1001 on 00:30 and continues)
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[])
{

   int bars = rates_total - 1;   
   if(prev_calculated > 0) bars = rates_total - prev_calculated;  
   
        for(int i = bars; i >= 1; i--)  
   {

      if(Close[i] > Open[i]) 
      {
         PlaySound(SoundFile);
      }

      if(Close[i] < Open[i]) 
      {
         PlaySound(SoundFile);
      }

//--- return value of rates_total for next call
   return(rates_total);
} 










 

avatar
872
eevviill 2016.03.09 23:02 #
 

Delete

 for(int i = bars; i >= 1; i--)   

   { 

avatar
52
renzbub 2016.03.10 11:22 #
 
eevviill:

Delete

   { 

Thanks for that it works.
Back to topics list  

To add comments, please log in or register