
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
I have the below code and I added SendMail("FXCM " + Symbol(),"H:");
to send me an email once there is a trend line touch
How can I make it send me an email only once when it touches the trend line
//+------------------------------------------------------------------+
//| HLine Alert.mq4 |//+------------------------------------------------------------------+
#property copyright "raff1410@o2.pl"
#property indicator_chart_window
extern string TLineName="MyLine2";
extern color LineColor=Red;
extern int LineStyle=STYLE_SOLID;
extern int AlertPipRange=0;
extern string AlertWav="alert.wav";
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int counted_bars=IndicatorCounted();
ObjectCreate(TLineName, OBJ_TREND, 0, Time[25], Bid, Time[0], Ask);
ObjectSet(TLineName, OBJPROP_STYLE, LineStyle);
ObjectSet(TLineName, OBJPROP_COLOR, LineColor);
double val=ObjectGetValueByShift(TLineName, 0);
if (Bid-AlertPipRange*Point <= val && Bid+AlertPipRange*Point >= val) PlaySound(AlertWav);
SendMail("FXCM " + Symbol(),"H:");
//----
//----
return(0);
}
//+------------------------------------------------------------------+