Alarm untill turned off

 

Hi

the file below is not working as intended. I need it to sound the alarm when the trend line is broker and it keeps the alarm on "repeat" untill I turn it off manually.

the work is not mine but been modified by me inorder to repeat untill manuall off action. please commnet

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

//| HLine Alert.mq4 |

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

#property copyright "raff1410@o2.pl"

#property indicator_chart_window

extern string TLineName="TrendLineRisingAlert";

extern color LineColor=Blue;

extern int LineStyle=STYLE_SOLID;

extern int LineWidth=1;

extern int AlertPipRange=1;

extern string AlertWav="rising-price-alert.wav";

bool EmailON=false;

bool turnOn = true;

extern bool stopAlarm = false;

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

//| Custom indicator initialization function |

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

int init()

{

//---- indicators

//----

return(0);

}

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

//| Custom indicator deinitialization function |

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

int deinit()

{

//----

//----

return(0);

}

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

//| Custom indicator iteration function |

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

int start()

{

ObjectCreate(TLineName, OBJ_TREND, 0, Time[25], Bid, Time[0], Ask);

ObjectSet(TLineName, OBJPROP_STYLE, LineStyle);

ObjectSet(TLineName, OBJPROP_COLOR, LineColor);

ObjectSet(TLineName, OBJPROP_WIDTH, LineWidth);

double val=ObjectGetValueByShift(TLineName, 0);

if (Bid-AlertPipRange*Point <= val &&

Bid+AlertPipRange*Point >= val && turnOn == false) turnOn = true;

if(turnOn == true && stopAlarm == false) PlaySound(AlertWav);

if (EmailON) SendMail("FX Currency Rising Price Alert","FX Currency Rising Price Alert");

//----

//----

return(0);

}

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