diff --git a/MtApi/MtApi.csproj b/MtApi/MtApi.csproj
index a68755fc..d9aba4da 100755
--- a/MtApi/MtApi.csproj
+++ b/MtApi/MtApi.csproj
@@ -64,6 +64,7 @@
+
diff --git a/MtApi/MtApiClient.cs b/MtApi/MtApiClient.cs
index 27ee271f..1e164773 100755
--- a/MtApi/MtApiClient.cs
+++ b/MtApi/MtApiClient.cs
@@ -1346,13 +1346,13 @@ namespace MtApi
if (res == null)
{
- throw new MtExecutionException(-1, "Response from MetaTrader is null");
+ throw new MtExecutionException(MtErrorCode.MtApiCustomError, "Response from MetaTrader is null");
}
var response = JsonConvert.DeserializeObject(res.Value);
if (response.ErrorCode != 0)
{
- throw new MtExecutionException(response.ErrorCode, response.ErrorMessage);
+ throw new MtExecutionException((MtErrorCode)response.ErrorCode, response.ErrorMessage);
}
return response;
diff --git a/MtApi/MtErrorCode.cs b/MtApi/MtErrorCode.cs
new file mode 100644
index 00000000..07546598
--- /dev/null
+++ b/MtApi/MtErrorCode.cs
@@ -0,0 +1,100 @@
+namespace MtApi
+{
+ public enum MtErrorCode
+ {
+ MtApiCustomError = -1, // Error occurred in MtApi.
+ NoError = 0, // No error returned.
+ NoResult = 1, // No error returned, but the result is unknown.
+ CommonError = 2, // Common error.
+ InvalidTradeParameters = 3, // Invalid trade parameters.
+ ServerBusy = 4, // Trade server is busy.
+ OldVersion = 5, // Old version of the client terminal.
+ NoConnection = 6, // No connection with trade server.
+ NotEnoughRights = 7, // Not enough rights.
+ TooFrequentRequests = 8, // Too frequent requests.
+ MalfunctionalTrade = 9, // Malfunctional trade operation.
+ AccountDisabled = 64, // Account disabled.
+ InvalidAccount = 65, // Invalid account.
+ TradeTimeout = 128, // Trade timeout.
+ InvalidPrice = 129, // Invalid price.
+ InvalidStops = 130, // Invalid stops.
+ InvalidTradeVolume = 131, // Invalid trade volume.
+ MarketClosed = 132, // Market is closed.
+ TradeDisabled = 133, // Trade is disabled.
+ NotEnoughMoney = 134, // Not enough money.
+ PriceChanged = 135, // Price changed.
+ OffQuotes = 136, // Off quotes.
+ BrokerBusy = 137, // Broker is busy.
+ Requote = 138, // Requote.
+ OrderLocked = 139, // Order is locked.
+ LongPositionsOnlyAllowed = 140, // Long positions only allowed.
+ TooManyRequests = 141, // Too many requests.
+ TradeModifyDenied = 145, // Modification denied because an order is too close to market.
+ TradeContextBusy = 146, // Trade context is busy.
+ TradeExpirationDenied = 147, // Expirations are denied by broker.
+ TradeTooManyOrders = 148, // The amount of opened and pending orders has reached the limit set by a broker.
+
+ NoMqlerror = 4000, // No error.
+ WrongFunctionPointer = 4001, // Wrong function pointer.
+ ArrayIndexOutOfRange = 4002, // Array index is out of range.
+ NoMemoryForFunctionCallStack = 4003, // No memory for function call stack.
+ RecursiveStackOverflow = 4004, // Recursive stack overflow.
+ NotEnoughStackForParameter = 4005, // Not enough stack for parameter.
+ NoMemoryForParameterString = 4006, // No memory for parameter string.
+ NoMemoryForTempString = 4007, // No memory for temp string.
+ NotInitializedString = 4008, // Not initialized string.
+ NotInitializedArraystring = 4009, // Not initialized string in an array.
+ NoMemoryForArraystring = 4010, // No memory for an array string.
+ TooLongString = 4011, // Too long string.
+ RemainderFromZeroDivide = 4012, // Remainder from zero divide.
+ ZeroDivide = 4013, // Zero divide.
+ UnknownCommand = 4014, // Unknown command.
+ WrongJump = 4015, // Wrong jump.
+ NotInitializedArray = 4016, // Not initialized array.
+ DllCallsNotAllowed = 4017, // DLL calls are not allowed.
+ CannotLoadLibrary = 4018, // Cannot load library.
+ CannotCallFunction = 4019, // Cannot call function.
+ ExternalExpertCallsNotAllowed = 4020, // EA function calls are not allowed.
+ NotEnoughMemoryForReturnedString = 4021, // Not enough memory for a string returned from a function.
+ SystemBusy = 4022, // System is busy.
+ InvalidFunctionParametersCount = 4050, // Invalid function parameters count.
+ InvalidFunctionParameterValue = 4051, // Invalid function parameter value.
+ StringFunctionInternalError = 4052, // String function internal error.
+ SomeArrayError = 4053, // Some array error.
+ IncorrectSeriesArrayUsing = 4054, // Incorrect series array using.
+ CustomIndicatorError = 4055, // Custom indicator error.
+ IncompatibleArrays = 4056, // Arrays are incompatible.
+ GlobalVariablesProcessingError = 4057, // Global variables processing error.
+ GlobalVariableNotFound = 4058, // Global variable not found.
+ FunctionNotAllowedInTestingMode = 4059, // Function is not allowed in testing mode.
+ FunctionNotConfirmed = 4060, // Function is not confirmed.
+ SendMailError = 4061, // Mail sending error.
+ StringParameterExpected = 4062, // String parameter expected.
+ IntegerParameterExpected = 4063, // Integer parameter expected.
+ DoubleParameterExpected = 4064, // Double parameter expected.
+ ArrayAsParameterExpected = 4065, // Array as parameter expected.
+ HistoryWillUpdated = 4066, // Requested history data in updating state.
+ TradeError = 4067, // Some error in trade operation execution.
+ EndOfFile = 4099, // End of a file.
+ SomeFileError = 4100, // Some file error.
+ WrongFileName = 4101, // Wrong file name.
+ TooManyOpenedFiles = 4102, // Too many opened files.
+ CannotOpenFile = 4103, // Cannot open file.
+ IncompatibleAccessToFile = 4104, // Incompatible access to a file.
+ NoOrderSelected = 4105, // No order selected.
+ UnknownSymbol = 4106, // Unknown symbol.
+ InvalidPriceParam = 4107, // Invalid price.
+ InvalidTicket = 4108, // Invalid ticket.
+ TradeNotAllowed = 4109, // Trade is not allowed.
+ LongsNotAllowed = 4110, // Longs are not allowed.
+ ShortsNotAllowed = 4111, // Shorts are not allowed.
+ ObjectAlreadyExists = 4200, // Object already exists.
+ UnknownObjectProperty = 4201, // Unknown object property.
+ ObjectDoesNotExist = 4202, // Object does not exist.
+ UnknownObjectType = 4203, // Unknown object type.
+ NoObjectName = 4204, // No object name.
+ ObjectCoordinatesError = 4205, // Object coordinates error.
+ NoSpecifiedSubwindow = 4206, // No specified subwindow.
+ SomeObjectError = 4207 // Some error in object operation.
+ }
+}
\ No newline at end of file
diff --git a/MtApi/MtExecutionException.cs b/MtApi/MtExecutionException.cs
index ecec0107..af294354 100644
--- a/MtApi/MtExecutionException.cs
+++ b/MtApi/MtExecutionException.cs
@@ -4,12 +4,12 @@ namespace MtApi
{
public class MtExecutionException: Exception
{
- public MtExecutionException(int errorCode, string message)
+ public MtExecutionException(MtErrorCode errorCode, string message)
:base(message)
{
ErrorCode = errorCode;
}
- public int ErrorCode { get; private set; }
+ public MtErrorCode ErrorCode { get; private set; }
}
}
\ No newline at end of file
diff --git a/TestApiClientUI/Form1.Designer.cs b/TestApiClientUI/Form1.Designer.cs
index 2eaa6e37..1541fa3b 100755
--- a/TestApiClientUI/Form1.Designer.cs
+++ b/TestApiClientUI/Form1.Designer.cs
@@ -275,6 +275,7 @@
this.listBoxEventLog.Name = "listBoxEventLog";
this.listBoxEventLog.Size = new System.Drawing.Size(690, 82);
this.listBoxEventLog.TabIndex = 14;
+ this.listBoxEventLog.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.listBoxEventLog_MouseDoubleClick);
//
// tabControl1
//
diff --git a/TestApiClientUI/Form1.cs b/TestApiClientUI/Form1.cs
index 5bb34d0d..fe3ebf3f 100755
--- a/TestApiClientUI/Form1.cs
+++ b/TestApiClientUI/Form1.cs
@@ -976,5 +976,10 @@ namespace TestApiClientUI
addToLog(result);
}
}
+
+ private void listBoxEventLog_MouseDoubleClick(object sender, MouseEventArgs e)
+ {
+ listBoxEventLog.Items.Clear();
+ }
}
}