a1arunner
13
a1arunner  

Need Help adding email to indicator alert

Can anyone help me add SendMail to this indicator? It alerts just fine but I cannot get it to send an email. My programming skills are very limited. Thank you for any help you can offer!

Mike

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

//| Fine Fractals.mq4 |

//| Copyright © 2009 Äåíèñ Îðëîâ |

//| Денис Орлов - Электронная музыка |

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

#property copyright "Copyright © 2009 Äåíèñ Îðëîâ"

#property link "http://denis-or-love.narod.ru"

#property indicator_chart_window

#property indicator_buffers 2

#property indicator_color1 Red

#property indicator_color2 Green

//---- buffers

double ExtMapBuffer1[];

double ExtMapBuffer2[];

extern bool Fine=True;

extern bool FlatShift=True;

extern bool NewFAlert=False;

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

//| iCustom indicator initialization function |

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

int init()

{

//---- indicators

SetIndexStyle(0, DRAW_ARROW);

SetIndexArrow(0,164);

SetIndexBuffer(0, ExtMapBuffer1);

SetIndexEmptyValue(0, 0.0);

SetIndexStyle(1, DRAW_ARROW);

SetIndexArrow(1, 164);

SetIndexBuffer(1, ExtMapBuffer2);

SetIndexEmptyValue(1, 0.0);

//---- name for DataWindow and indicator subwindow label

IndicatorShortName("Fine Fractals");

SetIndexLabel(0, "iFractalsUp");

SetIndexLabel(1, "iFractalsDn");

//----

return(0);

}

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

//| Custom indicator deinitialization function |

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

int deinit()

{

//----

return(0);

}

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

//| Custom indicator iteration function |

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

int start()

{

int counted_bars = IndicatorCounted();

//----

int limit;

//---- ïîñëåäíèé ïîñ÷èòàííûé áàð áóäåò ïåðåñ÷èòàí

if(counted_bars > 0)

counted_bars--;

limit = Bars - counted_bars;

//---- îñíîâíîé öèêë

for(int i = 2; i < limit; i++)

{

double

HP1=High,HP2=High,HP3=High,HPi=High,

LP1=Low,LP2=Low,LP3=Low, LPi=Low,

res=iFractals(NULL, 0, MODE_UPPER, i);

if(res==0 && Fine)//ïîâûøåííàÿ ÷óâñòâèòåëüíîñòü

{

if(HP1HP3 && (LP2>=LP3 || HP2>HPi)) res=HP2;

}

if(FlatShift && res!=0)// ñäâèãàåò ôðàêòàë ôëåòà

while(iHigh(NULL,0,i)==iHigh(NULL,0,i+1)) i++;

ExtMapBuffer1 = res;

if(res!=0 && i==2 && NewFAlert) Alert("Íîâûé âåðõíèé ôðàêòàë "+DoubleToStr(res,Digits));

res= iFractals(NULL, 0, MODE_LOWER, i);

if(res==0 && Fine)

{

if(LP1>LP2&&LP2<LP3&& (HP2<=HP3 || LP2<LPi)) res=LP2;

}

if(FlatShift && res!=0)

while(iLow(NULL,0,i)==iLow(NULL,0,i+1)) i++;

ExtMapBuffer2 =res;

if(res!=0 && i==2 && NewFAlert) Alert("Íîâûé íèæíèé ôðàêòàë "+DoubleToStr(res,Digits));

}

//----

return(0);

}

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

gpociejewski
57
gpociejewski  

[lang=pl]look at atache document. Better way is to use second method i think.

configure your in the way from this doc.

Next only what you need is to use SenMail(string subject, string mail body).

For example (sample from mt4)

double lastclose=Close[0];

if(lastclose<my_signal)

SendMail("from your expert", "Price dropped down to "+DoubleToStr(lastclose,Digits));

I think that is all. PM me or send email : g.pociejewski@luktom.biz if you'll have another questions.

Cheers,

Grzesiek[/lang]

a1arunner:
Can anyone help me add SendMail to this indicator? It alerts just fine but I cannot get it to send an email. My programming skills are very limited. Thank you for any help you can offer!

Mike

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

//| Fine Fractals.mq4 |

//| Copyright © 2009 Äåíèñ Îðëîâ |

//| Денис Орлов - Электронная музыка |

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

#property copyright "Copyright © 2009 Äåíèñ Îðëîâ"

#property link "http://denis-or-love.narod.ru"

#property indicator_chart_window

#property indicator_buffers 2

#property indicator_color1 Red

#property indicator_color2 Green

//---- buffers

double ExtMapBuffer1[];

double ExtMapBuffer2[];

extern bool Fine=True;

extern bool FlatShift=True;

extern bool NewFAlert=False;

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

//| iCustom indicator initialization function |

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

int init()

{

//---- indicators

SetIndexStyle(0, DRAW_ARROW);

SetIndexArrow(0,164);

SetIndexBuffer(0, ExtMapBuffer1);

SetIndexEmptyValue(0, 0.0);

SetIndexStyle(1, DRAW_ARROW);

SetIndexArrow(1, 164);

SetIndexBuffer(1, ExtMapBuffer2);

SetIndexEmptyValue(1, 0.0);

//---- name for DataWindow and indicator subwindow label

IndicatorShortName("Fine Fractals");

SetIndexLabel(0, "iFractalsUp");

SetIndexLabel(1, "iFractalsDn");

//----

return(0);

}

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

//| Custom indicator deinitialization function |

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

int deinit()

{

//----

return(0);

}

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

//| Custom indicator iteration function |

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

int start()

{

int counted_bars = IndicatorCounted();

//----

int limit;

//---- ïîñëåäíèé ïîñ÷èòàííûé áàð áóäåò ïåðåñ÷èòàí

if(counted_bars > 0)

counted_bars--;

limit = Bars - counted_bars;

//---- îñíîâíîé öèêë

for(int i = 2; i < limit; i++)

{

double

HP1=High,HP2=High,HP3=High,HPi=High,

LP1=Low,LP2=Low,LP3=Low, LPi=Low,

res=iFractals(NULL, 0, MODE_UPPER, i);

if(res==0 && Fine)//ïîâûøåííàÿ ÷óâñòâèòåëüíîñòü

{

if(HP1HP3 && (LP2>=LP3 || HP2>HPi)) res=HP2;

}

if(FlatShift && res!=0)// ñäâèãàåò ôðàêòàë ôëåòà

while(iHigh(NULL,0,i)==iHigh(NULL,0,i+1)) i++;

ExtMapBuffer1 = res;

if(res!=0 && i==2 && NewFAlert) Alert("Íîâûé âåðõíèé ôðàêòàë "+DoubleToStr(res,Digits));

res= iFractals(NULL, 0, MODE_LOWER, i);

if(res==0 && Fine)

{

if(LP1>LP2&&LP2<LP3&& (HP2<=HP3 || LP2<LPi)) res=LP2;

}

if(FlatShift && res!=0)

while(iLow(NULL,0,i)==iLow(NULL,0,i+1)) i++;

ExtMapBuffer2 =res;

if(res!=0 && i==2 && NewFAlert) Alert("Íîâûé íèæíèé ôðàêòàë "+DoubleToStr(res,Digits));

}

//----

return(0);

}

//+------------------------------------------------------------------+
vinodh2u
7
vinodh2u  

Please ...need alert added to Laguerre filter indicator

Hi Guru's,

Could you please add an MT4 alert and email alert to this indicator below. This indicator really works good for me to trade on Index.

Appreciate your help...please....

Vinodh

===========

#property copyright "Copyright © 2006, Forex-TSD.com "

#property link "https://www.forex-tsd.com/"

#property indicator_chart_window

#property indicator_color1 Yellow

//---- input parameters

extern double gamma = 0.7;

extern int Price_Type = 0;

//---- buffers

double Filter[];

double L0[];

double L1[];

double L2[];

double L3[];

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

//| Custom indicator initialization function |

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

int init()

{

IndicatorBuffers(5);

//---- indicators

SetIndexStyle(0, DRAW_LINE);

SetIndexDrawBegin(0, 1);

SetIndexLabel(0, "LaguerreFilter");

SetIndexBuffer(0, Filter);

SetIndexBuffer(1, L0);

SetIndexBuffer(2, L1);

SetIndexBuffer(3, L2);

SetIndexBuffer(4, L3);

//----

string short_name="LaguerreFilter(" + DoubleToStr(gamma, 2) + ")";

IndicatorShortName(short_name);

return(0);

}

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

//| Custor indicator deinitialization function |

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

int deinit()

{

return(0);

}

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

//| Custom indicator iteration function |

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

int start()

{

int limit;

int counted_bars = IndicatorCounted();

double CU, CD;

//---- last counted bar will be recounted

if (counted_bars>0)

counted_bars--;

else

counted_bars = 1;

limit = Bars - counted_bars;

//---- computations for RSI

for (int i=limit; i>=0; i--)

{

double Price=iMA(NULL,0,1,0,0,Price_Type,i);

L0 = (1.0 - gamma)*Price + gamma*L0;

L1 = -gamma*L0 + L0 + gamma*L1;

L2 = -gamma*L1 + L1 + gamma*L2;

L3 = -gamma*L2 + L2 + gamma*L3;

CU = 0;

CD = 0;

if (L0 >= L1)

CU = L0 - L1;

else

CD = L1 - L0;

if (L1 >= L2)

CU = CU + L1 - L2;

else

CD = CD + L2 - L1;

if (L2 >= L3)

CU = CU + L2 - L3;

else

CD = CD + L3 - L2;

if (CU + CD != 0)

Filter = (L0 + 2 * L1 + 2 * L2 + L3) / 6.0;

}

return(0);

}

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

=============================================

Mladen Rakic
207009
Mladen Rakic  

That is Laguerre filter and there are probably already versions with what you are looking for (check out this thread among others : https://www.mql5.com/en/forum/173022 )

vinodh_b:
Hi Guru's,

Could you please add an MT4 alert and email alert to this indicator below. This indicator really works good for me to trade on Index.

Appreciate your help...please....

Vinodh

===========

#property copyright "Copyright © 2006, Forex-TSD.com "

#property link "https://www.forex-tsd.com/"

#property indicator_chart_window

#property indicator_color1 Yellow

//---- input parameters

extern double gamma = 0.7;

extern int Price_Type = 0;

//---- buffers

double Filter[];

double L0[];

double L1[];

double L2[];

double L3[];

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

//| Custom indicator initialization function |

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

int init()

{

IndicatorBuffers(5);

//---- indicators

SetIndexStyle(0, DRAW_LINE);

SetIndexDrawBegin(0, 1);

SetIndexLabel(0, "LaguerreFilter");

SetIndexBuffer(0, Filter);

SetIndexBuffer(1, L0);

SetIndexBuffer(2, L1);

SetIndexBuffer(3, L2);

SetIndexBuffer(4, L3);

//----

string short_name="LaguerreFilter(" + DoubleToStr(gamma, 2) + ")";

IndicatorShortName(short_name);

return(0);

}

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

//| Custor indicator deinitialization function |

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

int deinit()

{

return(0);

}

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

//| Custom indicator iteration function |

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

int start()

{

int limit;

int counted_bars = IndicatorCounted();

double CU, CD;

//---- last counted bar will be recounted

if (counted_bars>0)

counted_bars--;

else

counted_bars = 1;

limit = Bars - counted_bars;

//---- computations for RSI

for (int i=limit; i>=0; i--)

{

double Price=iMA(NULL,0,1,0,0,Price_Type,i);

L0 = (1.0 - gamma)*Price + gamma*L0;

L1 = -gamma*L0 + L0 + gamma*L1;

L2 = -gamma*L1 + L1 + gamma*L2;

L3 = -gamma*L2 + L2 + gamma*L3;

CU = 0;

CD = 0;

if (L0 >= L1)

CU = L0 - L1;

else

CD = L1 - L0;

if (L1 >= L2)

CU = CU + L1 - L2;

else

CD = CD + L2 - L1;

if (L2 >= L3)

CU = CU + L2 - L3;

else

CD = CD + L3 - L2;

if (CU + CD != 0)

Filter = (L0 + 2 * L1 + 2 * L2 + L3) / 6.0;

}

return(0);

}

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

=============================================
KingdomVault
102
KingdomVault  

Here's The Indicator.

Thanks for taking your time. God Bless.

traderwawasan_indi_rantai.ex4

johnny2pips
46
johnny2pips  

Can you help me add a signal to this indicator please?

I'm trying to make/follow a system that works for my trading abilities. In order to do that I need to add a sound alert to heiken ashi smoothed.

Can any kind soul add a sound alert for when HA changes color?

Heiken Ash Smoothed

heiken_ashi_smoothed.ex4

If you can help I'd be vary grateful.

Edit: Also if possible to add an arrow along with the sound alert it would help a lot.

Sergey Golubev
Moderator
120135
Sergey Golubev  

This indicator with alert is on this post:

https://www.mql5.com/en/forum/179404

johnny2pips
46
johnny2pips  
newdigital:
This indicator with alert is on this post: https://www.mql5.com/en/forum/179404

Thank you so much Newdigital! This forum rocks, I'll be more active here from now on.

a1arunner
13
a1arunner  

alerts every tick

I found a very good Money Flow Index indicator with alerts and email. The only problem is it alerts/emails on every tick. Does anyone know how to make it just alert once when it crosses into oversold/overbought at the end of the bar? I could not attach for some reason so here is code. (sorry!) Thanks for any help!

Regards,

Mike

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

//| Money Flow Index.mq4 |

//|Modified by nlenz 2010 Copyright © 2005, MetaQuotes Software Corp.|

//| MetaTrader 5 Trading Platform / MetaQuotes Software Corp. |

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

#property copyright "Copyright © 2005, MetaQuotes Software Corp."

#property link "http://www.metaquotes.net/"

#property indicator_separate_window

#property indicator_minimum 0

#property indicator_maximum 100

#property indicator_level1 49

#property indicator_level2 51

#property indicator_buffers 1

#property indicator_color1 Blue

//---- input parameters

extern int ExtMFIPeriod=14;

extern double Oversold=49;

extern double Overbought=51;

extern bool alert=true;

extern bool emailAlert=false;

//---- buffers

double ExtMFIBuffer[];

bool alreadyalerted=false;

string alertstr;

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

//| Custom indicator initialization function |

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

int init()

{

string sShortName;

//----

SetIndexBuffer(0,ExtMFIBuffer);

//---- indicator line

SetIndexStyle(0,DRAW_LINE);

//---- name for DataWindow and indicator subwindow label

sShortName="MFI("+ExtMFIPeriod+")";

IndicatorShortName(sShortName);

SetIndexLabel(0,sShortName);

//---- first values aren't drawn

SetIndexDrawBegin(0,ExtMFIPeriod);

//----

return(0);

}

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

//| Money Flow Index |

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

int start()

{

int i,j,nCountedBars;

double dPositiveMF,dNegativeMF,dCurrentTP,dPreviousTP;

//---- insufficient data

if(Bars<=ExtMFIPeriod) return(0);

//---- bars count that does not changed after last indicator launch.

nCountedBars=IndicatorCounted();

//----

i=Bars-ExtMFIPeriod-1;

if(nCountedBars>ExtMFIPeriod)

i=Bars-nCountedBars-1;

while(i>=0)

{

dPositiveMF=0.0;

dNegativeMF=0.0;

dCurrentTP=(High+Low+Close)/3;

for(j=0; j<ExtMFIPeriod; j++)

{

dPreviousTP=(High+Low+Close)/3;

if(dCurrentTP>dPreviousTP)

dPositiveMF+=Volume*dCurrentTP;

else

{

if(dCurrentTP<dPreviousTP)

dNegativeMF+=Volume*dCurrentTP;

}

dCurrentTP=dPreviousTP;

}

//----

if(dNegativeMF!=0.0)

ExtMFIBuffer=100-100/(1+dPositiveMF/dNegativeMF);

else

ExtMFIBuffer=100;

//----

i--;

}

//----

if (ExtMFIBuffer[0] >= Overbought && alreadyalerted == false) {

alertstr = StringConcatenate("MFI is High for ", Symbol(), " M", Period());

if (alert == true)

Alert(alertstr);

if (emailAlert == true)

SendMail("MT4 Chart Alert", alertstr);

alreadyalerted = true;

}

else if (ExtMFIBuffer[0] <= Oversold && alreadyalerted == false) {

alertstr = StringConcatenate("MFI is Low for ", Symbol(), " M", Period());

if (alert == true)

Alert(alertstr);

if (emailAlert == true)

SendMail("MT4 Chart Alert", alertstr);

alreadyalerted = true;

}

else if (alreadyalerted == true) {

if (emailAlert == true) {

alertstr = StringConcatenate("MFI is back to Middle for ", Symbol(), " M", Period());

SendMail("MT4 Chart Alert", alertstr);

}

alreadyalerted = false;

}

return(0);

}

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

void doAlert(string doWhat)

{

static string previousAlert="nothing";

static datetime previousTime;

string message;

if (previousAlert != doWhat || previousTime != Time[0]) {

previousAlert = doWhat;

previousTime = Time[0];

//

//

//

//

//

message = StringConcatenate(Symbol()," at ",TimeToStr(TimeLocal(),TIME_SECONDS)," ma cross ",doWhat);

if (alert) Alert(message);

if (emailAlert) SendMail(StringConcatenate(Symbol()," ma cross "),message);

}

}

johnny2pips
46
johnny2pips  

Can you code a alert into this indicator (Heiken Ashi Exit)

This indicator is vary helpful especially when used with heiken ashi smoothed. It confirms a longer term trade is ready. If someone could code a signal to it I'd really appreciate your help.

heiken_ashi_exit.ex4

Files: