New article Developing graphical interfaces for Expert Advisors and indicators based on .Net Framework and C# has been published:
The article presents a simple and fast method of creating graphical windows using Visual Studio with subsequent integration into the Expert Advisor's MQL code. The article is meant for non-specialist audiences and does not require any knowledge of C# and .Net technology.
MetaTrader 5 strategy tester has a number
of features that should be considered by MQL GUI developers. The main
one is the fact that the OnChartEvent graphic event processing function
is not called at all. This feature is logical since the graphic form
involves working with a user in real time. However, it would be
extremely interesting to implement a certain type of panels in the
tester. These are the so-called trading players allowing
users to manually test their trading strategies. For example, the
strategy tester generates the current market prices in fast forward,
while a user clicks the Buy and Sell buttons simulating trading operations on history.
TradePanel that we have developed is exactly this type of panels.
Despite its simplicity, it may well be a plain trading player with the
most necessary functionality.
But let's think about how our panel
will work in the MetaTrader 5 strategy tester. TradePanel's graphical
window exists as an independent Net assembly. Therefore, it does not
depend on the current MetaTrader 5 environment or even the terminal
itself. Strictly speaking, it can be run from any other program, while
even users themselves can launch assemblies located in the exe
Thus, our program does not need to
call OnChartEvent. Moreover, it is possible to update data in the window
and receive new orders from users in any event handling function
regularly launched in the strategy tester. OnTick and OnTimer are such
functions. The panel works through them. Therefore, although designed
for real-time operation, our panel will also work well in the strategy
tester. No changes are required for that. Let's check this statement by
launching our panel in the tester and performing several deals:
Author: Vasiliy Sokolov
NOTE: In order to to get TradePanel.dll, at Visual Studio's Property Window, you need to right click at TradePanel.sln > Build.
Can this be used with WPF application as well or just window form ?
The code in the example is WinForms specific, but you can easily alter it for use with WPF. You just need to bind to different events on the WPF shell side. The code will be a bit different but the principles will remain the same.
You can also use the code as is if you just use the WinForms window as a host for XAML controls. You can do this with the new XAML Islands. This way you can use all of the modern UWP controls inside a WinForm.
Thank you for sharing your information
Can we use these codes in MT4 or only we can use it in MT5