Alert when for force index crosses a level???

 

Does anyone know the code to alert me when the force index crosses a defined level? It seems so easy, but I have not found anything.

Also, is there a generic alert script that I can say... "if this signal crosses this number alert me"... like the price alert, except for indicators?

Thanks for the help,

Matt

 

Answered my own question, now I have another

Does anyone know how to make the sendMail stop after sending one email?

To use a force index level alert...

Create an expert and replace the start function with this:

Force Index Level Alert

//+------------------------------------------------------------------+

//| expert start function |

//+------------------------------------------------------------------+

int start()

{

//----

int top_lvl = 0.0055;

int low_lvl = -0.0055;

if (iForce(NULL,0,13,MODE_EMA,PRICE_TYPICAL,0)>top_lvl||(iForce(NULL,0,13,MODE_EMA,PRICE_TYPICAL,0)<low_lvl)) {

Alert("The Force is: "+iForce(NULL,0,13,MODE_EMA,PRICE_TYPICAL,0));

//SendMail("Force Levels","Time to trade");

}

//----

return(0);

}

//+------------------------------------------------------------------+

To use a macd level alert...

MACD level alert

//+------------------------------------------------------------------+

//| expert start function |

//+------------------------------------------------------------------+

int start()

{

//----

int top_lvl = 0.004;

int low_lvl = -0.004;

if (iMACD(NULL,0,12,26,9,PRICE_MEDIAN,MODE_MAIN,0)>top_lvl||iMACD(NULL,0,12,26,9,PRICE_MEDIAN,MODE_MAIN,0)<low_lvl)

Alert("The MACD is: " + iMACD(NULL,0,12,26,9,PRICE_MEDIAN,MODE_MAIN,0));

//----

return(0);

}

//+------------------------------------------------------------------+

Reason: