Need help on Indicator (ADX CROSS with Alerts)

Durai C

Master Trader
May 24, 2017
38
0
47
37
Hi,

I have indicator and i want to add alert on it. Can anyone pls help me.
 

Attachments

  • ADX CROSS - WORK.mq4
    3.8 KB · Views: 35

Durai C

Master Trader
May 24, 2017
38
0
47
37
Thanks for reply. I did add the alert. But i am getting repeated alert. Its not stopping. So i posted here. Pls help me....
 

Enivid

Administrator
Staff member
Nov 30, 2008
18,607
1,366
144
Odesa
www.earnforex.com
Great! It means that you know some coding basics at least. Then you will have no problem fixing the indicator.
To prevent alerts from repeating indefinitely, you can use something like:
MQL4:
LastAlertTime = Time[0];
to remember the last time alert triggered and add it to the condition check like this:
MQL4:
if ((val1[0]!=EMPTY_VALUE) && (val1[0]!=0) && (SoundBuy) && (LastAlertTime != Time[0]))
 

Durai C

Master Trader
May 24, 2017
38
0
47
37
Thanks :) I comment there in coding. It is giving repeated alert and current one is no alert at all. I tried all possible ways. No luck. Can you pls make it work and post the file...
 

Enivid

Administrator
Staff member
Nov 30, 2008
18,607
1,366
144
Odesa
www.earnforex.com
Sorry, I am not here to code for you. You can apply the suggested changes if you want. If the current code does not give alerts at all, then you need remove the current alert code and to uncomment the lines that produced the alerts. Apply the LastAlertTime check to that code to prevent multiple alert calls of the same signal.
 

Durai C

Master Trader
May 24, 2017
38
0
47
37
Thanks. I have edited file and uploading here. Still i am getting run time error. Can you help me with this.
 

Attachments

  • ADX CROSS - V1.0.mq4
    3.3 KB · Views: 15

Enivid

Administrator
Staff member
Nov 30, 2008
18,607
1,366
144
Odesa
www.earnforex.com
That's a not a runtime error, that's a compilation error. To fix it, you need to declare LastAlertTime as a global variable in your code. You can do it like this, just below your line 25:
MQL4:
double b4plusdi,nowplusdi,b4minusdi,nowminusdi;
datetime LastAlertTime = D'';

You also need to add:
MQL4:
LastAlertTime = Time[0];
to each of the alert-calling scopes, otherwise it will not work.
 

Durai C

Master Trader
May 24, 2017
38
0
47
37
Thanks for reply. I have done what you asked. Still i am getting same repeated alert error. Can you pls guide me.
 

Attachments

  • ADX CROSS - V01.mq4
    3.2 KB · Views: 17

Enivid

Administrator
Staff member
Nov 30, 2008
18,607
1,366
144
Odesa
www.earnforex.com
Your conditions are checking whether the last alert time is not on the current bar, but your code never assigns the last alert time to any bar's time.
As I have said, you need to add this line to do that:
MQL4:
LastAlertTime = Time[0];
In your current code, I would add it after line 98 and line 90.
 

Durai C

Master Trader
May 24, 2017
38
0
47
37
Sorry. I don't understand. Can you pls help me to finish this indicator. It will be helpful, if you could finish it.
 

Durai C

Master Trader
May 24, 2017
38
0
47
37
I have worked and having still issue. I now i am getting every min alert for previous alert. Can you pls help me on this.
 

Attachments

  • ADX Crossing Alert V1.5.mq4
    5.2 KB · Views: 17

Durai C

Master Trader
May 24, 2017
38
0
47
37
HI... I have tested and improved the codes. Now i have finished 90% result. Still i have few issues. Pls help me with this. Check line 64 and 66. Pls help me.
 

Attachments

  • ADX_Crossing_V2.2.mq4
    3.3 KB · Views: 16

Durai C

Master Trader
May 24, 2017
38
0
47
37
Hi Andy. Thanks for reply. I have made some changes in Line 69 and 71. Now Alert is not working properly. Is shows always down alert and Ask value is wrong. Can you pls help me.
 

Attachments

  • ADX_Crossing_V2.2_Final.mq4
    3.9 KB · Views: 23