Interchange - MetaTrader 5 Library | Forex Indicators Download - MT4/MT5 Resources

Why you need this:
If you are creating a product for the market or do not want to use system DLLs, this class can help organize the exchange of data between programs.
For other cases, there are more reliable and faster methods for connecting applications. The exchange is implemented using simple structures.
How to use it:
Below is an example of transferring data from experts to indicators.
1.1. Create an instance of this class:
CInterchange Exp_buffer;
1.2. Set the prefix of the global variable name in OnInit() . To avoid conflicts with other instances of the class, give each instance a unique name:
Exp_buffer.SetPrefixNameForSave( _symbol + "_" +( string ) _period );
1.3. Algorithm operations are implemented using custom events. Simply add the following line to the OnChartEvent() handler:
Exp_buffer.OnEvent(id,lparam,dparam,sparam);
If the data to be transferred is ready (Exp_Data structure in the example), you need to call this method:
Exp_buffer.SendDataStart(Exp_Data);1.4. Don’t forget to destroy class instances during program deinitialization:
Exp_buffer.Destroy();
2.1. Create an instance of this class:
CInterchangeInd_buffer;2.2. Set the prefix of the global variable name in OnInit() . It must match the source - must be the same as in point 1.1.
Ind_buffer.SetPrefixNameForLoad( _symbol + "_" +( string ) _period );
2.3. To start the data transfer process, you need to call GetDataStart() with the Ind_data parameter (the structure used to write data from the EA);
Ind_buffer.GetDataStart(Ind_data);
2.4. Algorithm operations are implemented using custom events. Add the following lines to the OnChartEvent() handler:
Ind_buffer.OnEvent(id,lparam,dparam,sparam);
If the data transfer process is complete, the method:
Ind_buffer.GetDataFinish(Ind_data)
Return true.
2.5. Don’t forget to destroy class instances during program deinitialization:
Ind_buffer.Destroy();

Video and operation examples:
Attachment download
📎 interchange_expert.mq5 (3.07 KB)
📎 interchange_indicator.mq5 (5.08 KB)
📎 interchange.mqh (9.51 KB)
📎 my_struct.mqh (0.9 KB)
Source: MQL5 #12786
💡 Featured Recommendations
✍️ Latest by the author
- •
- •
- •
- •
- •
- •
📌 Popular topics
- •
- •
- •
- •
- •
- •
- •
- •
🔗 You May Be Interested In
- •
- •
- •
- •
- •
- •