How to send MT4/5 ( A ) variable value to other MT4/5( B )

 

HELLO dear coders


just want to send my Metatrader A  account  live equity   to    Metatrader B  expert adviser   as   a live value . so Expert adviser  B  shows it as comment on chart /

whats the true way to do this , 

both metatraders are open at the same laptop .  

 

All MetaTrader 4/5 have a common folder path for a same pc. You can get this folder path with this function below. 

string common_path = TerminalInfoString(TERMINAL_COMMONDATA_PATH);

In this folder you can save a txt file from your program with any info like Equity/Balance. Then read this file from your other terminal with a program. That way you can transfer any info from one terminal to another.

 
Mahadi Hasan Razu #:

All MetaTrader 4/5 have a common folder path for a same pc. You can get this folder path with this function below. 

In this folder you can save a txt file from your program with any info like Equity/Balance. Then read this file from your other terminal with a program. That way you can transfer any info from one terminal to another.

OO MY GOD. i really surprised by your answer . i didnt even know that there is a common folder in metatrader .\

but the problem here is  i use a command of open file to create and write like this


int file_handle = FileOpen("target.txt", FILE_WRITE, FILE_TXT);


but this command create the txt file in metatraders A  special file directory . and i dont know how to navigate the common file directon , because it wont exit from its own file folder anyway .

could you please write the command of writing a text file in common folder plase

 
Emir Nazimi #: OO MY GOD. i really surprised by your answer . i didnt even know that there is a common folder in metatrader .\ but the problem here is  i use a command of open file to create and write like this. but this command create the txt file in metatraders A  special file directory . and i dont know how to navigate the common file directon , because it wont exit from its own file folder anyway . could you please write the command of writing a text file in common folder plase

Please read the documentation on FileOpen ...

open_flags

[in] combination of flags determining the operation mode for the file. The flags are defined as follows:
FILE_READ file is opened for reading
FILE_WRITE file is opened for writing
FILE_BIN binary read-write mode (no conversion from a string and to a string)
FILE_CSV file of csv type (all recorded items are converted to the strings of unicode or ansi type, and are separated by a delimiter)
FILE_TXT a simple text file (the same as csv, but the delimiter is not taken into account)
FILE_ANSI lines of ANSI type (single-byte symbols)
FILE_UNICODE lines of UNICODE type (double-byte characters)
FILE_SHARE_READ shared reading from several programs
FILE_SHARE_WRITE shared writing from several programs
FILE_COMMON location of the file in a shared folder for all client terminals \Terminal\Common\Files

Documentation on MQL5: Constants, Enumerations and Structures / Input/Output Constants / File Opening Flags
Documentation on MQL5: Constants, Enumerations and Structures / Input/Output Constants / File Opening Flags
  • www.mql5.com
File Opening Flags - Input/Output Constants - Constants, Enumerations and Structures - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5