Sound Alert for MFI BW indicator

 

Hi all,


I'm trying to add PlaySound() to MFI BW indicator to alert me a change in bar color following the article here. Unfortunately, the article doesn't have an example code for this type of "compare" indicator. Could someone help and point me to any similar example code or if someone can help to write the codes? I want to run alert.wav continuously when the indicator color change to pink (MFI down, Volume up) and only stop if the color change to any other color (lime, blue, brown - MFI up-Vol up, MFI up-Vol Down, MFI down-Vol down, respectively). If it easy to accomplish, I need the alert to continue as long as the color stay the same until I close a message box (or something).


Thanks.
 

Adx

Easy enough for you to write as an EA, eg

   double OSMA_2 = iOsMA("USDCHF",PERIOD_H1,12,26,9,PRICE_CLOSE,2);
   double OSMA_1 = iOsMA("USDCHF",PERIOD_H1,12,26,9,PRICE_CLOSE,1);


   if((OSMA_2<0) && (OSMA_1>0)) PlaySound("yankee doodle.wav");

   if((OSMA_2>0) && (OSMA_1<0)) PlaySound("whistle dixie.wav");

Advantage of an EA is you can refer to one or many standard indicators & you can change the sounds from once to 'continuous', i.e. every tick?

Also a single 'Alert EA' can handle Alerts from n charts & timeframes

Good Luck

-BB-

 
BarrowBoy:

Adx

Easy enough for you to write as an EA, eg

Advantage of an EA is you can refer to one or many standard indicators & you can change the sounds from once to 'continuous', i.e. every tick?

Also a single 'Alert EA' can handle Alerts from n charts & timeframes

Good Luck

-BB-

Thanks for the prompt reply BB. I'm obviously new to this and been doing all manually. I'll follow your idea. So, could you point me to a reading material for a start?



Edit: I'm off downloading the free MQL4 e-book above.



Thanks.

 

Adx

Not used this indicator before, but as a guess, based on it not having any external parameters, you would have an EA that looked something like this.

This will play the sounds on every tick (price change) while the condition persists - when the EA is attached to the current chart

init()
{

}

start()
{

double ExtMFI = iCustom(NULL, 0, "MFI BW", 0, 0)           // Black
double ExtMFIUpVUp = iCustom(NULL, 0, "MFI BW", 1, 0)      // Lime
double ExtMFIDownVDown = iCustom(NULL, 0, "MFI BW", 2, 0)  // Saddlebrown
double ExtMFIUpVDown = iCustom(NULL, 0, "MFI BW", 3, 0)    // Blue
double ExtMFIDownVUp = iCustom(NULL, 0, "MFI BW", 4, 0)    // Pink


   if(ExtMFIUpVUp>ExtMFIDownVDown) PlaySound("yankee doodle.wav");

   if(ExtMFIUpVDown<ExtMFIDownVUp) PlaySound("whistle dixie.wav");

}

deinit()
{

}

FWIW

-BB-

 
BarrowBoy:

Adx

Not used this indicator before, but as a guess, based on it not having any external parameters, you would have an EA that looked something like this.

This will play the sounds on every tick (price change) while the condition persists - when the EA is attached to the current chart

FWIW

-BB-

Thanks BB.

Reason: