//+------------------------------------------------------------------+ //| #SR_AlertSystem.mq4 | //| Steve Fleming | //| http://www.forexarea.com | //+------------------------------------------------------------------+ #property copyright "Steve Fleming" #property link "http://www.forexarea.com" #property indicator_chart_window extern bool AlarmOn = true; // alarm on or off? extern bool SignalOnClose = false; // if false we will use Bid price to signal piercing of S/R levels extern string ResistanceLineName = "R_Alert"; // name of SR line that will trigger Alarm extern string SupportLineName = "S_Alert"; // name of SR line that will trigger Alarm extern string SoundFile = "mrplow.wav"; // name of sound file extern int DelayBetweenAlarm = 10; // extern color SRLineClr = DarkOrchid; // color of SR lines extern int SRLineWidth = 2; // width of SR lines //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicators if(ObjectFind(ResistanceLineName) != 0){ ObjectCreate(ResistanceLineName, OBJ_HLINE, 0, 0,iHigh(NULL, 0, 0)); ObjectSet(ResistanceLineName, OBJPROP_COLOR, SRLineClr); ObjectSet(ResistanceLineName, OBJPROP_WIDTH, SRLineWidth); ObjectCreate(SupportLineName, OBJ_HLINE, 0, 0,iLow(NULL, 0, 0)); ObjectSet(SupportLineName, OBJPROP_COLOR, SRLineClr); ObjectSet(SupportLineName, OBJPROP_WIDTH, SRLineWidth); } //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- ObjectDelete(ResistanceLineName); ObjectDelete(SupportLineName); //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { //---- if(AlarmOn){ double PreviousClosePrice = Bid; if(SignalOnClose == true){PreviousClosePrice = iClose(NULL, 0, 1);} double ResistancePrice = ObjectGet(ResistanceLineName, OBJPROP_PRICE1); double SupportPrice = ObjectGet(SupportLineName, OBJPROP_PRICE1); if(PreviousClosePrice > ResistancePrice && ResistancePrice != 0)Alerts(1); if(PreviousClosePrice < SupportPrice && SupportPrice != 0)Alerts(2); } //----ho ho ho!!!! return(0); } //+------------------------------------------------------------------+ void Alerts(int Direction) { static datetime AlertLastTime = 0; if(TimeCurrent() > AlertLastTime ) { AlertLastTime = TimeCurrent()+DelayBetweenAlarm; PlaySound(SoundFile); } }
Sample
Analysis
Market Information Used:
Series array that contains the highest prices of each bar
Series array that contains the lowest prices of each bar
Series array that contains close prices for each bar
Indicator Curves created:
Indicators Used:
Custom Indicators Used:
Order Management characteristics:
Other Features:
It plays sound alerts