diff --git a/MtApi5/Mt5CommandType.cs b/MtApi5/Mt5CommandType.cs
index 980e0b07..91a8a252 100755
--- a/MtApi5/Mt5CommandType.cs
+++ b/MtApi5/Mt5CommandType.cs
@@ -108,6 +108,8 @@ namespace MtApi5
//Backtesting
BacktestingReady = 66,
- IsTesting = 67
+ IsTesting = 67,
+
+ Print = 68
}
}
diff --git a/MtApi5/MtApi5Client.cs b/MtApi5/MtApi5Client.cs
index d9717047..a06a679e 100755
--- a/MtApi5/MtApi5Client.cs
+++ b/MtApi5/MtApi5Client.cs
@@ -1392,6 +1392,19 @@ namespace MtApi5
#endregion
+ #region Common Functions
+ ///
+ ///It enters a message in the Expert Advisor log.
+ ///
+ ///Symbol name.
+ public bool Print(string message)
+ {
+ var commandParameters = new ArrayList { message };
+
+ return SendCommand(Mt5CommandType.Print, commandParameters);
+ }
+ #endregion
+
#endregion
#region Properties
diff --git a/TestClients/MtApi5TestClient/MainWindow.xaml b/TestClients/MtApi5TestClient/MainWindow.xaml
index a07eaaf6..4fcfe520 100755
--- a/TestClients/MtApi5TestClient/MainWindow.xaml
+++ b/TestClients/MtApi5TestClient/MainWindow.xaml
@@ -263,36 +263,52 @@
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
diff --git a/TestClients/MtApi5TestClient/ViewModel.cs b/TestClients/MtApi5TestClient/ViewModel.cs
index 4208a8ba..f76b78e4 100755
--- a/TestClients/MtApi5TestClient/ViewModel.cs
+++ b/TestClients/MtApi5TestClient/ViewModel.cs
@@ -47,6 +47,8 @@ namespace MtApi5TestClient
public DelegateCommand MarketBookGetCommand { get; private set; }
public DelegateCommand PositionOpenCommand { get; private set; }
+
+ public DelegateCommand PrintCommand { get; private set; }
#endregion
#region Properties
@@ -131,6 +133,17 @@ namespace MtApi5TestClient
public ObservableCollection TimeSeriesResults { get; } = new ObservableCollection();
+ private string _messageText = "Print some text in MetaTrader expert console";
+ public string MessageText
+ {
+ get { return _messageText; }
+ set
+ {
+ _messageText = value;
+ OnPropertyChanged("MessageText");
+ }
+ }
+
#endregion
#region Public Methods
@@ -210,6 +223,8 @@ namespace MtApi5TestClient
MarketBookGetCommand = new DelegateCommand(ExecuteMarketBookGet);
PositionOpenCommand = new DelegateCommand(ExecutePositionOpen);
+
+ PrintCommand = new DelegateCommand(ExecutePrint);
}
private bool CanExecuteConnect(object o)
@@ -711,6 +726,14 @@ namespace MtApi5TestClient
AddLog($"PositionOpen: symbol EURUSD result = {retVal}");
}
+ private async void ExecutePrint(object obj)
+ {
+ var message = MessageText;
+
+ var retVal = await Execute(() => _mtApiClient.Print(message));
+ AddLog($"Print: message print in MetaTrader - {retVal}");
+ }
+
private static void RunOnUiThread(Action action)
{
Application.Current?.Dispatcher.Invoke(action);
diff --git a/mq5/MtApi5.ex5 b/mq5/MtApi5.ex5
index b1a04ee3..a0764cdd 100755
Binary files a/mq5/MtApi5.ex5 and b/mq5/MtApi5.ex5 differ
diff --git a/mq5/MtApi5.mq5 b/mq5/MtApi5.mq5
index 45f11a9c..af19c114 100755
--- a/mq5/MtApi5.mq5
+++ b/mq5/MtApi5.mq5
@@ -1692,6 +1692,18 @@ int executeCommand()
sendBooleanResponse(ExpertHandle, IsTesting());
}
break;
+
+ case 68: //Print
+ {
+ string printMsg;
+ StringInit(printMsg, 1000, 0);
+
+ getStringValue(ExpertHandle, 0, printMsg);
+
+ Print(printMsg);
+ sendBooleanResponse(ExpertHandle, true);
+ }
+ break;
default:
Print("Unknown command type = ", commandType);