MT4 Push Notifications

 

Hi guys,


I have been reading around but unfortunately I can't find any solution to my issue, so I would like to ask you for help.

I'm currently using MetaTrader 4 Build 1090 under a Demo Account and for some reason I can't seem to get my custom indicator to send me Push Messages to my Xperia XZ.

I have my MetaQuotes ID set correct on MT4 settings and I'm able to receive Test Notifications just fine, however when it comes to my Indicator I can not seem to get those, however I'm able to receive Alerts and MessageBox on computer just fine.

Well, here is the relevant part of my code (I believe):

extern bool pushNotifications = true;

void myFunction(int shift)
{
    // Some code...

    if(pushNotifications == true)
        PushNotifications("Put Signal on: ", currentPeak);
}

void PushNotifications(string message, int shift)
{
    if(shift <= 2 && Time[shift] != lastAlertTime)
    {
        lastAlertTime = Time[shift];
        SendNotification(message + Symbol());
    }
}

Any help please ?
 

Maybe "shift" is a bar number, but at the origin of call....

PushNotifications( "Put Signal on: " , currentPeak);

It is "currentPeak". What is this?

There seems to be a problem here, but I do not know because there is no program.

 
int currentPeak = shift; 

So, maybe there is no problem in "currentPeak".


 extern bool    pushNotifications = true ;

You can't use "PushNotifications" as a function name, because it is used for setting.

So, you should change "pushNotifications" on line 140, 172 and 224 to "pushNotificationsCall".

PushNotificationsCall("Put Signal on: ", currentPeak); 

How about this?

 
Naguisa Unada:

So, maybe there is no problem in "currentPeak".


You can't use "PushNotifications" as a function name, because it is used for setting.

So, you should change "pushNotifications" on line 140, 172 and 224 to "pushNotificationsCall".

How about this?

Even though I don't consider it a good pratice myself, I don't believe that is the reason as MQL4 is case-sensitive...

(I will give it a try though)


Besides I can use the SendNotification() outside the

if(shift <= 2 && Time[shift] != lastAlertTime)

condition without trouble, but it spams my mobile with notifications.

The issue seems to be on that condition I just can't figure out what it is...

 
I have confirmed that it works without problem on my MT4.
 
Naguisa Unada:
I have confirmed that it works without no problem on my MT4.

Hmm...really? which version you are using?

 
Darkz0r :

Hmm...really? which version you are using?

Builed 1090.

You should not compile it without changing the function name.

 
Darkz0r:

Hi guys,


I have been reading around but unfortunately I can't find any solution to my issue, so I would like to ask you for help.

I'm currently using MetaTrader 4 Build 1090 under a Demo Account and for some reason I can't seem to get my custom indicator to send me Push Messages to my Xperia XZ.

I have my MetaQuotes ID set correct on MT4 settings and I'm able to receive Test Notifications just fine, however when it comes to my Indicator I can not seem to get those, however I'm able to receive Alerts and MessageBox on computer just fine.

Well, here is the relevant part of my code (I believe):


Any help please ?

Hi, did you solve the problem yet?

I got curious and take a look at your code and guess what, it's work just fine.

Here is some modification I've made using my own coding style. Just received a notification for a real and demo account on my phone this morning. 

This confirms that this indicator is working on my machine, try it on yours.

Good luck.

Files:
 

Hello Guys

i have just signed up like now and i am still a novice, trying to learn to trade. am i at the right place and anyone patient enough to hold me by hand? Cheers!

 
Thank you guys I got it to work, I had a little modification on my own code that was preventing it from using Sendnotification() 
 
Darkz0r:
Thank you guys I got it to work, I had a little modification on my own code that was preventing it from using Sendnotification() 

Thanks for the code

Reason: