How to correctly build notifications

 

Hi there,

I've tried to build a notification following the MQL5 guidelines, that's something like this:

               string CC=StringFormat(" [",CustomComment,"]");
               string PTC=StringFormat("Positions to close: ",TC);
               string LS=StringFormat(", loss: ",DoubleToString(SLoss++,2));
               string PS=StringFormat(", profit: ",DoubleToString(SProfit++,2));
               string Notification=(string)StringConcatenate(PTC,PS,LS,CC);SendNotification(Notification);

Result should be something like this:

Positions to close: 3, profit: 12, loss: 5 [CustomComment]

When I check if it's OK the print result is always '20'.

Anyone can see what's wrong?

 

But since you were argumentative (twice (2019)) and (five times (2019)) I won't be helping. Two (2) years later, you are still arguing (2021.06.10) with people trying to help you, I will not be helping you.

 
William Roeder #:

But since you were argumentative (twice (2019)) and (five times (2019)) I won't be helping. Two (2) years later, you are still arguing (2021.06.10) with people trying to help you.

WTH are you always annoying me with thesame thing? I'm just trying to build a notification.

 
David Diez: I've tried to build a notification following the MQL5 guidelines, that's something like this: Result should be something like this: Positions to close: 3, profit: 12, loss: 5 [CustomComment] When I check if it's OK the print result is always '20'. Anyone can see what's wrong?
Please read the documentation on StringFormat function again attentively. You are using it incorrectly.
Documentation on MQL5: Conversion Functions / StringFormat
Documentation on MQL5: Conversion Functions / StringFormat
  • www.mql5.com
StringFormat - Conversion Functions - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
 
While you are at it, read over the documentation for StringConcatenate again as well, as you are also using it incorrectly too.
Documentation on MQL5: String Functions / StringConcatenate
Documentation on MQL5: String Functions / StringConcatenate
  • www.mql5.com
StringConcatenate - String Functions - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5