How I can define the name of the file with respect to the chart symbol?

 

I have tried the following and got the error:

#define filename  _Symbol+"_Trade_reatime.csv";

input string forecast_fetch=filename;

Error got is: 

'+' - constant expected Trade_Real_Time.mq5     87      29

Please let me know what I can do to have this sort of file name. My signal vary with respect to the symbol on chart. Hence, I need to have the file name with respect to chart to avoid typing file name every time. Please let me know the way out.

 

Try:

string filename  _Symbol+"_Trade_reatime.csv";

The compiler doesn't allow 'your' #define!

 
Carl Schreiber:

Try:

The compiler doesn't allow 'your' #define!

I tried this:  

string filename = _Symbol+"_Trade_reatime.csv";
input string forecast_fetch=filename;

Got this error:  

'filename' - constant expected  Trade_Real_Test.mq5     85      29
Still the error persists.
 
No that is because you are trying to assign a value to a static input which you can not change.
 

You can't even change input variables ion mql5 (other than extern in mql4!!)

input string forecast_fetch = "";
string _forecast_fetch; //aux. var.
...
int OnInit() {
   _forecast_fetch = (forecast_fetch != "") forecast_fetch : filename;
...
}
 
Carl Schreiber:

You can't even change input variables ion mql5 (other than extern in mql4!!)

So that means there is no way out for my problem.. right?

 
string filename = _Symbol+"_Trade_reatime.csv";

This should be sufficient.

If you want to add more by input parameter:

static input string somestring="blablablah_";

string filename = somestring+_Symbol+"_Trade_reatime.csv";
Not the way around.
 
Carl Schreiber:

You can't even change input variables ion mql5 (other than extern in mql4!!)

MQL5 has `extern` as well. 

Reason: