Variables Not Being Placed in Email Body

27 views Asked by At

I have set out a load of variables which are to be sent out in an informational (is that even a word? It should be a word ;)) email when a position is executed.

Everything works as programmed and an email is indeed sent when a position has been successfully filled by the broker.

However, despite correctly declaring my variables, I'm getting blank spaces in my email where the variables should be.

The GlobalNamespace.mqh file initially declares the variables and sets them as string variables. The EA (which, by the way, calls the GlobalNamespace.mqh file) and assigns each variable with MQL4's functions. The EA then passes control to the file containing the SendMail() Statement.

The file containing the SendMail() statement also calls the GlobalNamespace.mqh file in order to determine that they are string variables, and sends the email but without the variables.

I don't see any reason whatsoever as to why there are blank spaces where these variables should be placed in the email body, as they are correctly initialised and the appropriate #include files are ...well, included.

Why is MetaEditor refusing go play ball?

It makes no sense.

My MQH GlobalNamespace.mqh file is as follows:


string            ExecutionPrice;
string            ExecutionTimeframe;
string            ExecutionSymbol;

My MQL File (EA) is as follows

#include <GlobalNamespace.mqh>

void OnTick(){
//---
   //Data pertaining to the executed position.
   ExecutionSymbol              =  Symbol();
   ExecutionTimeframe       =  IntegerToString(Period()/60,0);
   ExecutionPrice               =  DoubleToString(OrderOpenPrice(),Digits);

   if(......){

    <Run SendMail.mqh>

   }

 //---
}

This is the MQH file SendMail.mqh which sends the email upon an event:

#include <GlobalNamespace.mqh>

SendMail("<subject>,"Symbol"+ExecutionSymbol+"  Price"+ExecutionPrice+"  Timeframe"+ExecutionTimeframe);

These variables are used in a number of files, therefore I do not wish to declare them locally.

Bypassing the EA when declaring the global variables

0

There are 0 answers