Hello, how do I modify this code to also email me when an alert is made?
Thanks
Thanks
Inserted Code
//+------------------------------------------------------------------+ //| StochCrossStrength.mq4 | //| Copyright © 2006 [email protected] | //+------------------------------------------------------------------+ #property copyright "FxFisherman.com" #property link "http://www.fxfisherman.com" #property indicator_chart_window #property indicator_buffers 1 #include <WinUser32.mqh> double Stoch_K = 0; double Stoch_D = 0; double Stoch_Slowing = 0; extern string Sound1 = "alert.wav"; extern string Sound2 = "alert2.wav"; extern int TimeFrame_1 = 5, // {1=M1, 5=M5, 15=M15, ..., 1440=D1, 10080=W1, 43200=MN1} KPeriod_1 = 5, DPeriod_1 = 3, Slowing_1 = 3, MAMethod_1 = 0, // {0=SMA, 1=EMA, 2=SMMA, 3=LWMA} PriceField_1 = 0; // {0=Hi/Low, 1=Close/Close} extern bool UseOpenCandle_1 = true; extern int TimeFrame_2 = 15, // {1=M1, 5=M5, 15=M15, ..., 1440=D1, 10080=W1, 43200=MN1} KPeriod_2 = 5, DPeriod_2 = 3, Slowing_2 = 3, MAMethod_2 = 0, // {0=SMA, 1=EMA, 2=SMMA, 3=LWMA} PriceField_2 = 0, // {0=Hi/Low, 1=Close/Close} StochLevelHigh_2 = 70, // The stoch value for this time frame must be greater than this value StochLevelLow_2 = 30, // The stoch value for this time frame must be less than this value. PeriodOfInc_Dec_2 = 0; // This is a check for the total number of closed candles that have increased or decreased consectively for condition to be true // Set to zero and UseOpenCandle_2 = true if only open candle to check for condition is desired // Set to 1 if 1 closed candle is desired for condition and then open candle option as desired. Etc for more closed candles extern bool UseOpenCandle_2 = true; extern bool UseStochCondition_3 = true; // This is if the user wants to use the stoch 3 and stoch 4 condition check extern int TimeFrame_3 = 60, // {1=M1, 5=M5, 15=M15, ..., 1440=D1, 10080=W1, 43200=MN1} KPeriod_3 = 5, DPeriod_3 = 3, Slowing_3 = 3, MAMethod_3 = 0, // {0=SMA, 1=EMA, 2=SMMA, 3=LWMA} PriceField_3 = 0, // {0=Hi/Low, 1=Close/Close} StochLevelHigh_3 = 70, // The stoch value for this time frame must be greater than this value StochLevelLow_3 = 30, // The stoch value for this time frame must be less than this value PeriodOfInc_Dec_3 = 0; // This is a check for the total number of closed candles that have increased or decreased consectively for condition to be true // Set to zero and UseOpenCandle_3 = true if only open candle to check for condition is desired // Set to 1 if 1 closed candle is desired for condition and then open candle option as desired. Etc for more closed candles extern bool UseOpenCandle_3 = true; extern bool UseStochCondition_4 = true; // This is if the user wants to use the stoch 4 condition check extern int TimeFrame_4 = 60, // {1=M1, 5=M5, 15=M15, ..., 1440=D1, 10080=W1, 43200=MN1} KPeriod_4 = 5, DPeriod_4 = 3, Slowing_4 = 3, MAMethod_4 = 0, // {0=SMA, 1=EMA, 2=SMMA, 3=LWMA} PriceField_4 = 0, // {0=Hi/Low, 1=Close/Close} StochLevelHigh_4 = 70, // The stoch value for this time frame must be greater than this value StochLevelLow_4 = 30, // The stoch value for this time frame must be less than this value PeriodOfInc_Dec_4 = 0; // This is a check for the total number of closed candles that have increased or decreased consectively for condition to be true // Set to zero and UseOpenCandle_4 = true if only open candle to check for condition is desired // Set to 1 if 1 closed candle is desired for condition and then open candle option as desired. Etc for more closed candles extern bool UseOpenCandle_4 = true; //---- buffers double v1[]; int init() { IndicatorBuffers(1); SetIndexDrawBegin(0,-1); SetIndexBuffer(0, v1); SetIndexLabel(0,"Buy"); watermark(); return(0); } int start() { // Calculate values double stochk0 = iStochastic(Symbol(), Period(), Stoch_K,Stoch_D, Stoch_Slowing, MODE_SMA, 0, MODE_MAIN, 1); double stochd0 = iStochastic(Symbol(), Period(), Stoch_K,Stoch_D, Stoch_Slowing, MODE_SMA, 0, MODE_SIGNAL, 1); double stochk1 = iStochastic(Symbol(), Period(), Stoch_K,Stoch_D, Stoch_Slowing, MODE_SMA, 0, MODE_MAIN, 2); double stochd1 = iStochastic(Symbol(), Period(), Stoch_K,Stoch_D, Stoch_Slowing, MODE_SMA, 0, MODE_SIGNAL, 2); int strength = 100 - (MathAbs(stochk0-stochd0)*5); if (strength<0) strength=0; // Output static datetime last_cross; if (last_cross != Time[0]) { if (stochk1 <= stochd1 && stochk0 > stochd0) { last_cross = Time[0]; PlaySound(Sound1); Alert(Symbol(), " ", Period(), " Stoch ", Stoch_K, ",", Stoch_D, ",", Stoch_Slowing, " Up @ ", stochk1); //Alert("Stoch crosses up!"); }else if(stochk1 >= stochd1 && stochk0 < stochd0){ last_cross = Time[0]; PlaySound(Sound2); Alert(Symbol(), " ", Period(), " Stoch ", Stoch_K, ",", Stoch_D, ",", Stoch_Slowing, " Dn @ ", stochk1); //Alert("Stoch crosses down!"); } } return(0); } void watermark() { ObjectCreate("fxfisherman", OBJ_LABEL, 0, 0, 0); ObjectSetText("fxfisherman", "fxfisherman.com", 11, "Lucida Handwriting", Black); ObjectSet("fxfisherman", OBJPROP_CORNER, 2); ObjectSet("fxfisherman", OBJPROP_XDISTANCE, 5); ObjectSet("fxfisherman", OBJPROP_YDISTANCE, 10); return(0); } //+------------------------------------------------------------------+
24 hours in a day – 24 bottles of beer in a case – Coincidence? I think not