mirror of
https://github.com/vdemydiuk/mtapi.git
synced 2026-07-28 02:57:56 +00:00
Compare commits
11 Commits
MT5-v1.0.10
...
v1.0.31
| Author | SHA1 | Date | |
|---|---|---|---|
| 26a3db9ae1 | |||
| 7d3af82e1f | |||
| 09b72fc64d | |||
| 834b0af430 | |||
| 5dd1e4831d | |||
| 39f11bfc34 | |||
| c6faaf0602 | |||
| 6b4adfaa97 | |||
| db4bb44fb3 | |||
| 68d5fa98af | |||
| dc28823ca9 |
+187
-158
@@ -19,56 +19,56 @@ using namespace System::Diagnostics;
|
||||
|
||||
void convertSystemString(wchar_t* dest, String^ src)
|
||||
{
|
||||
pin_ptr<const wchar_t> wch = PtrToStringChars(src);
|
||||
memcpy(dest, wch, wcslen(wch) * sizeof(wchar_t));
|
||||
dest[wcslen(wch)] = '\0';
|
||||
pin_ptr<const wchar_t> wch = PtrToStringChars(src);
|
||||
memcpy(dest, wch, wcslen(wch) * sizeof(wchar_t));
|
||||
dest[wcslen(wch)] = '\0';
|
||||
}
|
||||
|
||||
int _stdcall initExpert(int expertHandle, int port, wchar_t* symbol, double bid, double ask, wchar_t* err)
|
||||
{
|
||||
try
|
||||
{
|
||||
MT4Handler^ mtHandler = gcnew MT4Handler();
|
||||
try
|
||||
{
|
||||
MT4Handler^ mtHandler = gcnew MT4Handler();
|
||||
|
||||
MtServerInstance::GetInstance()->InitExpert(expertHandle, port, gcnew String(symbol), bid, ask, mtHandler);
|
||||
}
|
||||
catch (Exception^ e)
|
||||
{
|
||||
convertSystemString(err, e->Message);
|
||||
Debug::WriteLine("[ERROR] MTConnector:initExpert(): " + e->Message);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
MtServerInstance::GetInstance()->InitExpert(expertHandle, port, gcnew String(symbol), bid, ask, mtHandler);
|
||||
}
|
||||
catch (Exception^ e)
|
||||
{
|
||||
convertSystemString(err, e->Message);
|
||||
Debug::WriteLine("[ERROR] MTConnector:initExpert(): " + e->Message);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int _stdcall deinitExpert(int expertHandle, wchar_t* err)
|
||||
{
|
||||
try
|
||||
{
|
||||
MtServerInstance::GetInstance()->DeinitExpert(expertHandle);
|
||||
}
|
||||
catch (Exception^ e)
|
||||
{
|
||||
convertSystemString(err, e->Message);
|
||||
Debug::WriteLine("[ERROR] MTConnector:deinitExpert(): " + e->Message);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
try
|
||||
{
|
||||
MtServerInstance::GetInstance()->DeinitExpert(expertHandle);
|
||||
}
|
||||
catch (Exception^ e)
|
||||
{
|
||||
convertSystemString(err, e->Message);
|
||||
Debug::WriteLine("[ERROR] MTConnector:deinitExpert(): " + e->Message);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int _stdcall updateQuote(int expertHandle, wchar_t* symbol, double bid, double ask, wchar_t* err)
|
||||
{
|
||||
try
|
||||
{
|
||||
MtServerInstance::GetInstance()->SendQuote(expertHandle, gcnew String(symbol), bid, ask);
|
||||
}
|
||||
catch (Exception^ e)
|
||||
{
|
||||
convertSystemString(err, e->Message);
|
||||
Debug::WriteLine("[ERROR] MTConnector:updateQuote(): " + e->Message);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
try
|
||||
{
|
||||
MtServerInstance::GetInstance()->SendQuote(expertHandle, gcnew String(symbol), bid, ask);
|
||||
}
|
||||
catch (Exception^ e)
|
||||
{
|
||||
convertSystemString(err, e->Message);
|
||||
Debug::WriteLine("[ERROR] MTConnector:updateQuote(): " + e->Message);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -89,170 +89,199 @@ int _stdcall sendEvent(int expertHandle, int eventType, wchar_t* payload, wchar_
|
||||
|
||||
int _stdcall sendIntResponse(int expertHandle, int response)
|
||||
{
|
||||
try
|
||||
{
|
||||
MtServerInstance::GetInstance()->SendResponse(expertHandle, gcnew MtResponseInt(response));
|
||||
}
|
||||
catch (Exception^ e)
|
||||
{
|
||||
Debug::WriteLine("[ERROR] MTConnector:sendIntResponse(): " + e->Message);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
try
|
||||
{
|
||||
MtServerInstance::GetInstance()->SendResponse(expertHandle, gcnew MtResponseInt(response));
|
||||
}
|
||||
catch (Exception^ e)
|
||||
{
|
||||
Debug::WriteLine("[ERROR] MTConnector:sendIntResponse(): " + e->Message);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int _stdcall sendBooleanResponse(int expertHandle, int response)
|
||||
{
|
||||
try
|
||||
{
|
||||
bool value = (response != 0) ? true : false;
|
||||
try
|
||||
{
|
||||
bool value = (response != 0) ? true : false;
|
||||
|
||||
MtServerInstance::GetInstance()->SendResponse(expertHandle, gcnew MtResponseBool(value));
|
||||
}
|
||||
catch (Exception^ e)
|
||||
{
|
||||
Debug::WriteLine("[ERROR] MTConnector:sendBooleanResponse(): " + e->Message);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
MtServerInstance::GetInstance()->SendResponse(expertHandle, gcnew MtResponseBool(value));
|
||||
}
|
||||
catch (Exception^ e)
|
||||
{
|
||||
Debug::WriteLine("[ERROR] MTConnector:sendBooleanResponse(): " + e->Message);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int _stdcall sendDoubleResponse(int expertHandle, double response)
|
||||
{
|
||||
try
|
||||
{
|
||||
MtServerInstance::GetInstance()->SendResponse(expertHandle, gcnew MtResponseDouble(response));
|
||||
}
|
||||
catch (Exception^ e)
|
||||
{
|
||||
Debug::WriteLine("[ERROR] MTConnector:sendDoubleResponse(): " + e->Message);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
try
|
||||
{
|
||||
MtServerInstance::GetInstance()->SendResponse(expertHandle, gcnew MtResponseDouble(response));
|
||||
}
|
||||
catch (Exception^ e)
|
||||
{
|
||||
Debug::WriteLine("[ERROR] MTConnector:sendDoubleResponse(): " + e->Message);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int _stdcall sendStringResponse(int expertHandle, wchar_t* response)
|
||||
{
|
||||
try
|
||||
{
|
||||
MtServerInstance::GetInstance()->SendResponse(expertHandle, gcnew MtResponseString(gcnew String(response)));
|
||||
}
|
||||
catch (Exception^ e)
|
||||
{
|
||||
Debug::WriteLine("[ERROR] MTConnector:sendStringResponse(): " + e->Message);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
try
|
||||
{
|
||||
MtServerInstance::GetInstance()->SendResponse(expertHandle, gcnew MtResponseString(gcnew String(response)));
|
||||
}
|
||||
catch (Exception^ e)
|
||||
{
|
||||
Debug::WriteLine("[ERROR] MTConnector:sendStringResponse(): " + e->Message);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int _stdcall sendVoidResponse(int expertHandle)
|
||||
{
|
||||
try
|
||||
{
|
||||
MtServerInstance::GetInstance()->SendResponse(expertHandle, nullptr);
|
||||
}
|
||||
catch (Exception^ e)
|
||||
{
|
||||
Debug::WriteLine("[ERROR] MTConnector:sendVoidResponse(): " + e->Message);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
try
|
||||
{
|
||||
MtServerInstance::GetInstance()->SendResponse(expertHandle, nullptr);
|
||||
}
|
||||
catch (Exception^ e)
|
||||
{
|
||||
Debug::WriteLine("[ERROR] MTConnector:sendVoidResponse(): " + e->Message);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int _stdcall sendDoubleArrayResponse(int expertHandle, double* values, int size)
|
||||
{
|
||||
try
|
||||
{
|
||||
array<double>^ list = gcnew array<double>(size);
|
||||
try
|
||||
{
|
||||
array<double>^ list = gcnew array<double>(size);
|
||||
|
||||
for(int i = 0; i < size; i++)
|
||||
{
|
||||
list[i] = values[i];
|
||||
}
|
||||
for(int i = 0; i < size; i++)
|
||||
{
|
||||
list[i] = values[i];
|
||||
}
|
||||
|
||||
MtServerInstance::GetInstance()->SendResponse(expertHandle, gcnew MtResponseDoubleArray(list));
|
||||
}
|
||||
catch (Exception^ e)
|
||||
{
|
||||
Debug::WriteLine("[ERROR] MTConnector:sendDoubleArrayResponse(): " + e->Message);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
MtServerInstance::GetInstance()->SendResponse(expertHandle, gcnew MtResponseDoubleArray(list));
|
||||
}
|
||||
catch (Exception^ e)
|
||||
{
|
||||
Debug::WriteLine("[ERROR] MTConnector:sendDoubleArrayResponse(): " + e->Message);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int _stdcall sendIntArrayResponse(int expertHandle, int* values, int size)
|
||||
{
|
||||
try
|
||||
{
|
||||
array<int>^ list = gcnew array<int>(size);
|
||||
try
|
||||
{
|
||||
array<int>^ list = gcnew array<int>(size);
|
||||
|
||||
for(int i = 0; i < size; i++)
|
||||
{
|
||||
list[i] = values[i];
|
||||
}
|
||||
for(int i = 0; i < size; i++)
|
||||
{
|
||||
list[i] = values[i];
|
||||
}
|
||||
|
||||
MtServerInstance::GetInstance()->SendResponse(expertHandle, gcnew MtResponseIntArray(list));
|
||||
}
|
||||
catch (Exception^ e)
|
||||
{
|
||||
Debug::WriteLine("[ERROR] MTConnector:sendIntArrayResponse(): " + e->Message);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
MtServerInstance::GetInstance()->SendResponse(expertHandle, gcnew MtResponseIntArray(list));
|
||||
}
|
||||
catch (Exception^ e)
|
||||
{
|
||||
Debug::WriteLine("[ERROR] MTConnector:sendIntArrayResponse(): " + e->Message);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int _stdcall sendLongResponse(int expertHandle, __int64 response)
|
||||
{
|
||||
try
|
||||
{
|
||||
MtServerInstance::GetInstance()->SendResponse(expertHandle, gcnew MtResponseLong(response));
|
||||
}
|
||||
catch (Exception^ e)
|
||||
{
|
||||
Debug::WriteLine("[ERROR] MTConnector:sendLongResponse(): " + e->Message);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int _stdcall getCommandType(int expertHandle, int* res)
|
||||
{
|
||||
try
|
||||
{
|
||||
*res = MtServerInstance::GetInstance()->GetCommandType(expertHandle);
|
||||
}
|
||||
catch (Exception^ e)
|
||||
{
|
||||
Debug::WriteLine("[ERROR] MTConnector:getCommandType(): " + e->Message);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
try
|
||||
{
|
||||
*res = MtServerInstance::GetInstance()->GetCommandType(expertHandle);
|
||||
}
|
||||
catch (Exception^ e)
|
||||
{
|
||||
Debug::WriteLine("[ERROR] MTConnector:getCommandType(): " + e->Message);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int _stdcall getIntValue(int expertHandle, int paramIndex, int* res)
|
||||
{
|
||||
try
|
||||
{
|
||||
*res = (int)MtServerInstance::GetInstance()->GetCommandParameter(expertHandle, paramIndex);
|
||||
}
|
||||
catch (Exception^ e)
|
||||
{
|
||||
Debug::WriteLine("[ERROR] MTConnector:getIntValue(): " + e->Message);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
try
|
||||
{
|
||||
*res = (int)MtServerInstance::GetInstance()->GetCommandParameter(expertHandle, paramIndex);
|
||||
}
|
||||
catch (Exception^ e)
|
||||
{
|
||||
Debug::WriteLine("[ERROR] MTConnector:getIntValue(): " + e->Message);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int _stdcall getDoubleValue(int expertHandle, int paramIndex, double* res)
|
||||
{
|
||||
try
|
||||
{
|
||||
*res = (double)MtServerInstance::GetInstance()->GetCommandParameter(expertHandle, paramIndex);
|
||||
}
|
||||
catch (Exception^ e)
|
||||
{
|
||||
Debug::WriteLine("[ERROR] MTConnector:getDoubleValue(): " + e->Message);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
try
|
||||
{
|
||||
*res = (double)MtServerInstance::GetInstance()->GetCommandParameter(expertHandle, paramIndex);
|
||||
}
|
||||
catch (Exception^ e)
|
||||
{
|
||||
Debug::WriteLine("[ERROR] MTConnector:getDoubleValue(): " + e->Message);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int _stdcall getStringValue(int expertHandle, int paramIndex, wchar_t* res)
|
||||
{
|
||||
try
|
||||
{
|
||||
convertSystemString(res, (String^)MtServerInstance::GetInstance()->GetCommandParameter(expertHandle, paramIndex));
|
||||
}
|
||||
catch (Exception^ e)
|
||||
{
|
||||
Debug::WriteLine("[ERROR] MTConnector:getStringValue(): " + e->Message);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
try
|
||||
{
|
||||
convertSystemString(res, (String^)MtServerInstance::GetInstance()->GetCommandParameter(expertHandle, paramIndex));
|
||||
}
|
||||
catch (Exception^ e)
|
||||
{
|
||||
Debug::WriteLine("[ERROR] MTConnector:getStringValue(): " + e->Message);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int _stdcall getBooleanValue(int expertHandle, int paramIndex, int* res)
|
||||
{
|
||||
try
|
||||
{
|
||||
bool val = (bool)MtServerInstance::GetInstance()->GetCommandParameter(expertHandle, paramIndex);
|
||||
*res = val == true ? 1 : 0;
|
||||
}
|
||||
catch (Exception^ e)
|
||||
{
|
||||
Debug::WriteLine("[ERROR] MT5Connector:getBooleanValue(): " + e->Message);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
+14
-12
@@ -3,15 +3,17 @@ LIBRARY MTConnector
|
||||
EXPORTS initExpert
|
||||
deinitExpert
|
||||
updateQuote
|
||||
sendEvent
|
||||
sendIntResponse
|
||||
sendBooleanResponse
|
||||
sendDoubleResponse
|
||||
sendStringResponse
|
||||
sendVoidResponse
|
||||
sendDoubleArrayResponse
|
||||
sendIntArrayResponse
|
||||
getCommandType
|
||||
getIntValue
|
||||
getDoubleValue
|
||||
getStringValue
|
||||
sendEvent
|
||||
sendIntResponse
|
||||
sendBooleanResponse
|
||||
sendDoubleResponse
|
||||
sendStringResponse
|
||||
sendVoidResponse
|
||||
sendDoubleArrayResponse
|
||||
sendIntArrayResponse
|
||||
sendLongResponse
|
||||
getCommandType
|
||||
getIntValue
|
||||
getDoubleValue
|
||||
getStringValue
|
||||
getBooleanValue
|
||||
@@ -0,0 +1,31 @@
|
||||
namespace MtApi
|
||||
{
|
||||
//MQL4: ENUM_SYMBOL_INFO_INTEGER
|
||||
public enum EnumSymbolInfoInteger
|
||||
{
|
||||
SYMBOL_SELECT = 0,
|
||||
SYMBOL_VISIBLE = 76,
|
||||
SYMBOL_SESSION_DEALS = 56,
|
||||
SYMBOL_SESSION_BUY_ORDERS = 60,
|
||||
SYMBOL_SESSION_SELL_ORDERS = 62,
|
||||
SYMBOL_VOLUME = 10,
|
||||
SYMBOL_VOLUMEHIGH = 11,
|
||||
SYMBOL_VOLUMELOW = 12,
|
||||
SYMBOL_TIME = 15,
|
||||
SYMBOL_DIGITS = 17,
|
||||
SYMBOL_SPREAD = 18,
|
||||
SYMBOL_SPREAD_FLOAT = 41,
|
||||
SYMBOL_TRADE_CALC_MODE = 29,
|
||||
SYMBOL_TRADE_MODE = 30,
|
||||
SYMBOL_START_TIME = 51,
|
||||
SYMBOL_EXPIRATION_TIME = 52,
|
||||
SYMBOL_TRADE_STOPS_LEVEL = 31,
|
||||
SYMBOL_TRADE_FREEZE_LEVEL = 32,
|
||||
SYMBOL_TRADE_EXEMODE = 33,
|
||||
SYMBOL_SWAP_MODE = 37,
|
||||
SYMBOL_SWAP_ROLLOVER3DAYS = 40,
|
||||
SYMBOL_EXPIRATION_MODE = 49,
|
||||
SYMBOL_FILLING_MODE = 50,
|
||||
SYMBOL_ORDER_MODE = 71
|
||||
}
|
||||
}
|
||||
@@ -59,6 +59,7 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="ChartPeriod.cs" />
|
||||
<Compile Include="EnumSymbolInfoInteger.cs" />
|
||||
<Compile Include="ExtensionMethods.cs" />
|
||||
<Compile Include="Monitors\AvailabilityOrdersEventArgs.cs" />
|
||||
<Compile Include="MqlRates.cs" />
|
||||
@@ -72,6 +73,7 @@
|
||||
<Compile Include="MtOrder.cs" />
|
||||
<Compile Include="MtQuote.cs" />
|
||||
<Compile Include="MtQuoteEventArgs.cs" />
|
||||
<Compile Include="MtSession.cs" />
|
||||
<Compile Include="MtTimeBar.cs" />
|
||||
<Compile Include="MtTypes.cs" />
|
||||
<Compile Include="Monitors\TradeMonitor.cs" />
|
||||
@@ -90,6 +92,7 @@
|
||||
<Compile Include="Requests\OrderDeleteRequest.cs" />
|
||||
<Compile Include="Requests\OrderModifyRequest.cs" />
|
||||
<Compile Include="Requests\OrderSendRequest.cs" />
|
||||
<Compile Include="Requests\SessionRequest.cs" />
|
||||
<Compile Include="Requests\RequestBase.cs" />
|
||||
<Compile Include="Requests\RequestType.cs" />
|
||||
<Compile Include="Responses\CopyRatesResponse.cs" />
|
||||
@@ -97,6 +100,7 @@
|
||||
<Compile Include="Responses\GetOrdersResponse.cs" />
|
||||
<Compile Include="Responses\ICustomResponse.cs" />
|
||||
<Compile Include="Responses\OrderSendResponse.cs" />
|
||||
<Compile Include="Responses\SessionResponse.cs" />
|
||||
<Compile Include="Responses\ResponseBase.cs" />
|
||||
<Compile Include="SeriesIdentifier.cs" />
|
||||
<Compile Include="TimeBarArgs.cs" />
|
||||
|
||||
@@ -658,6 +658,63 @@ namespace MtApi
|
||||
|
||||
#endregion
|
||||
|
||||
#region Symbols
|
||||
///<summary>
|
||||
///Returns the number of available (selected in Market Watch or all) symbols.
|
||||
///</summary>
|
||||
///<param name="selected">Request mode. Can be true or false.</param>
|
||||
///<returns>
|
||||
///If the 'selected' parameter is true, the function returns the number of symbols selected in MarketWatch. If the value is false, it returns the total number of all symbols.
|
||||
///</returns>
|
||||
public int SymbolsTotal(bool selected)
|
||||
{
|
||||
var commandParameters = new ArrayList { selected };
|
||||
return SendCommand<int>(MtCommandType.SymbolsTotal, commandParameters);
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///Returns the name of a symbol.
|
||||
///</summary>
|
||||
///<param name="pos">Order number of a symbol.</param>
|
||||
///<param name="selected">Request mode. If the value is true, the symbol is taken from the list of symbols selected in MarketWatch. If the value is false, the symbol is taken from the general list.</param>
|
||||
///<returns>
|
||||
///Value of string type with the symbol name.
|
||||
///</returns>
|
||||
public string SymbolName(int pos, bool selected)
|
||||
{
|
||||
var commandParameters = new ArrayList { pos, selected };
|
||||
return SendCommand<string>(MtCommandType.SymbolName, commandParameters);
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///Selects a symbol in the Market Watch window or removes a symbol from the window.
|
||||
///</summary>
|
||||
///<param name="name">Symbol name</param>
|
||||
///<param name="select">Switch. If the value is false, a symbol should be removed from MarketWatch, otherwise a symbol should be selected in this window. A symbol can't be removed if the symbol chart is open, or there are open orders for this symbol.</param>
|
||||
///<returns>
|
||||
///In case of failure returns false.
|
||||
///</returns>
|
||||
public bool SymbolSelect(string name, bool select)
|
||||
{
|
||||
var commandParameters = new ArrayList { name, select };
|
||||
return SendCommand<bool>(MtCommandType.SymbolSelect, commandParameters);
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///Returns the corresponding property of a specified symbol.
|
||||
///</summary>
|
||||
///<param name="name">Symbol name</param>
|
||||
///<param name="propId">Identifier of a symbol property. The value can be one of the values of the EnumSymbolInfoInteger enumeration</param>
|
||||
///<returns>
|
||||
///The value of long type.
|
||||
///</returns>
|
||||
public long SymbolInfoInteger(string name, EnumSymbolInfoInteger propId)
|
||||
{
|
||||
var commandParameters = new ArrayList { name, (int)propId };
|
||||
return SendCommand<long>(MtCommandType.SymbolInfoInteger, commandParameters);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Common Function
|
||||
|
||||
public void Alert(string msg)
|
||||
@@ -1423,6 +1480,12 @@ namespace MtApi
|
||||
var commandParameters = new ArrayList { name, (int)propId };
|
||||
return SendCommand<string>(MtCommandType.SymbolInfoString, commandParameters); ;
|
||||
}
|
||||
|
||||
public MtSession SymbolInfoSession(string symbol, DayOfWeek dayOfWeek, uint index, SessionType type)
|
||||
{
|
||||
var responce = SendRequest<SessionResponse>(new SessionRequest { Symbol = symbol, DayOfWeek = dayOfWeek, SessionIndex = (int)index, SessionType = type });
|
||||
return responce != null ? responce.Session : null;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Private Methods
|
||||
|
||||
@@ -195,6 +195,12 @@ namespace MtApi
|
||||
MtRequest = 155,
|
||||
|
||||
//Backtesting
|
||||
BacktestingReady = 156
|
||||
BacktestingReady = 156,
|
||||
|
||||
//Symbols
|
||||
SymbolsTotal = 200,
|
||||
SymbolName = 201,
|
||||
SymbolSelect = 202,
|
||||
SymbolInfoInteger = 203
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MtApi
|
||||
{
|
||||
public class MtSession
|
||||
{
|
||||
public string Symbol { get; set; }
|
||||
public DayOfWeek DayOfWeek { get; set; }
|
||||
public uint Index { get; set; }
|
||||
public int MtFromTime { get; set; }
|
||||
public DateTime From
|
||||
{
|
||||
get { return MtApiTimeConverter.ConvertFromMtTime(MtFromTime); }
|
||||
}
|
||||
public int MtToTime { get; set; }
|
||||
public DateTime To
|
||||
{
|
||||
get { return MtApiTimeConverter.ConvertFromMtTime(MtToTime); }
|
||||
}
|
||||
public bool HasData { get; set; }
|
||||
public SessionType Type { get; set; }
|
||||
}
|
||||
|
||||
public enum SessionType { Quote, Trade }
|
||||
}
|
||||
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.30.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.30.0")]
|
||||
[assembly: AssemblyVersion("1.0.31.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.31.0")]
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
OrderDelete = 6,
|
||||
OrderModify = 7,
|
||||
iCustom = 8,
|
||||
CopyRates = 9
|
||||
CopyRates = 9,
|
||||
Session = 10,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
using System;
|
||||
|
||||
namespace MtApi.Requests
|
||||
{
|
||||
public class SessionRequest : RequestBase
|
||||
{
|
||||
public string Symbol { get; set; }
|
||||
public DayOfWeek DayOfWeek { get; set; }
|
||||
public int SessionIndex { get; set; }
|
||||
public SessionType SessionType { get; set; }
|
||||
|
||||
public override RequestType RequestType
|
||||
{
|
||||
get { return RequestType.Session; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace MtApi.Responses
|
||||
{
|
||||
public class SessionResponse : ResponseBase
|
||||
{
|
||||
public MtSession Session { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
|
||||
<?define ProductName="MtApi" ?>
|
||||
<?define ProductVersion="1.0.30" ?>
|
||||
<?define ProductVersion="1.0.31" ?>
|
||||
<?define Manufacturer="DW"?>
|
||||
<?define ProductPath="..\build\products\$(var.Configuration)\"?>
|
||||
|
||||
|
||||
+143
-15
@@ -139,13 +139,21 @@
|
||||
this.button6 = new System.Windows.Forms.Button();
|
||||
this.listBoxProceHistory = new System.Windows.Forms.ListBox();
|
||||
this.tabPage6 = new System.Windows.Forms.TabPage();
|
||||
this.textBoxPrint = new System.Windows.Forms.TextBox();
|
||||
this.button27 = new System.Windows.Forms.Button();
|
||||
this.button14 = new System.Windows.Forms.Button();
|
||||
this.button13 = new System.Windows.Forms.Button();
|
||||
this.tabPage7 = new System.Windows.Forms.TabPage();
|
||||
this.button23 = new System.Windows.Forms.Button();
|
||||
this.iCustomBtn = new System.Windows.Forms.Button();
|
||||
this.button27 = new System.Windows.Forms.Button();
|
||||
this.textBoxPrint = new System.Windows.Forms.TextBox();
|
||||
this.tabPage8 = new System.Windows.Forms.TabPage();
|
||||
this.comboBox4 = new System.Windows.Forms.ComboBox();
|
||||
this.button32 = new System.Windows.Forms.Button();
|
||||
this.button30 = new System.Windows.Forms.Button();
|
||||
this.button29 = new System.Windows.Forms.Button();
|
||||
this.button28 = new System.Windows.Forms.Button();
|
||||
this.label28 = new System.Windows.Forms.Label();
|
||||
this.textBox1 = new System.Windows.Forms.TextBox();
|
||||
this.groupBox1.SuspendLayout();
|
||||
this.statusStrip1.SuspendLayout();
|
||||
this.groupBox2.SuspendLayout();
|
||||
@@ -161,6 +169,7 @@
|
||||
((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit();
|
||||
this.tabPage6.SuspendLayout();
|
||||
this.tabPage7.SuspendLayout();
|
||||
this.tabPage8.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// textBoxServerName
|
||||
@@ -323,6 +332,7 @@
|
||||
this.tabControl1.Controls.Add(this.tabPage5);
|
||||
this.tabControl1.Controls.Add(this.tabPage6);
|
||||
this.tabControl1.Controls.Add(this.tabPage7);
|
||||
this.tabControl1.Controls.Add(this.tabPage8);
|
||||
this.tabControl1.Location = new System.Drawing.Point(12, 147);
|
||||
this.tabControl1.Name = "tabControl1";
|
||||
this.tabControl1.SelectedIndex = 0;
|
||||
@@ -1359,6 +1369,23 @@
|
||||
this.tabPage6.Text = "Client Terminal";
|
||||
this.tabPage6.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// textBoxPrint
|
||||
//
|
||||
this.textBoxPrint.Location = new System.Drawing.Point(209, 16);
|
||||
this.textBoxPrint.Name = "textBoxPrint";
|
||||
this.textBoxPrint.Size = new System.Drawing.Size(386, 20);
|
||||
this.textBoxPrint.TabIndex = 3;
|
||||
//
|
||||
// button27
|
||||
//
|
||||
this.button27.Location = new System.Drawing.Point(601, 16);
|
||||
this.button27.Name = "button27";
|
||||
this.button27.Size = new System.Drawing.Size(75, 23);
|
||||
this.button27.TabIndex = 2;
|
||||
this.button27.Text = "Print";
|
||||
this.button27.UseVisualStyleBackColor = true;
|
||||
this.button27.Click += new System.EventHandler(this.button27_Click);
|
||||
//
|
||||
// button14
|
||||
//
|
||||
this.button14.Location = new System.Drawing.Point(13, 45);
|
||||
@@ -1411,22 +1438,113 @@
|
||||
this.iCustomBtn.UseVisualStyleBackColor = true;
|
||||
this.iCustomBtn.Click += new System.EventHandler(this.iCustomBtn_Click);
|
||||
//
|
||||
// button27
|
||||
// tabPage8
|
||||
//
|
||||
this.button27.Location = new System.Drawing.Point(601, 16);
|
||||
this.button27.Name = "button27";
|
||||
this.button27.Size = new System.Drawing.Size(75, 23);
|
||||
this.button27.TabIndex = 2;
|
||||
this.button27.Text = "Print";
|
||||
this.button27.UseVisualStyleBackColor = true;
|
||||
this.button27.Click += new System.EventHandler(this.button27_Click);
|
||||
this.tabPage8.Controls.Add(this.comboBox4);
|
||||
this.tabPage8.Controls.Add(this.button32);
|
||||
this.tabPage8.Controls.Add(this.button30);
|
||||
this.tabPage8.Controls.Add(this.button29);
|
||||
this.tabPage8.Controls.Add(this.button28);
|
||||
this.tabPage8.Controls.Add(this.label28);
|
||||
this.tabPage8.Controls.Add(this.textBox1);
|
||||
this.tabPage8.Location = new System.Drawing.Point(4, 22);
|
||||
this.tabPage8.Name = "tabPage8";
|
||||
this.tabPage8.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.tabPage8.Size = new System.Drawing.Size(682, 377);
|
||||
this.tabPage8.TabIndex = 8;
|
||||
this.tabPage8.Text = "Symbols";
|
||||
this.tabPage8.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// textBoxPrint
|
||||
// comboBox4
|
||||
//
|
||||
this.textBoxPrint.Location = new System.Drawing.Point(209, 16);
|
||||
this.textBoxPrint.Name = "textBoxPrint";
|
||||
this.textBoxPrint.Size = new System.Drawing.Size(386, 20);
|
||||
this.textBoxPrint.TabIndex = 3;
|
||||
this.comboBox4.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.comboBox4.FormattingEnabled = true;
|
||||
this.comboBox4.Items.AddRange(new object[] {
|
||||
"SYMBOL_SELECT",
|
||||
"SYMBOL_VISIBLE",
|
||||
"SYMBOL_SESSION_DEALS",
|
||||
"SYMBOL_SESSION_BUY_ORDERS",
|
||||
"SYMBOL_SESSION_SELL_ORDERS",
|
||||
"SYMBOL_VOLUME",
|
||||
"SYMBOL_VOLUMEHIGH",
|
||||
"SYMBOL_VOLUMELOW",
|
||||
"SYMBOL_TIME",
|
||||
"SYMBOL_DIGITS",
|
||||
"SYMBOL_SPREAD",
|
||||
"SYMBOL_SPREAD_FLOAT",
|
||||
"SYMBOL_TRADE_CALC_MODE",
|
||||
"SYMBOL_TRADE_MODE",
|
||||
"SYMBOL_START_TIME",
|
||||
"SYMBOL_EXPIRATION_TIME",
|
||||
"SYMBOL_TRADE_STOPS_LEVEL",
|
||||
"SYMBOL_TRADE_FREEZE_LEVEL",
|
||||
"SYMBOL_TRADE_EXEMODE",
|
||||
"SYMBOL_SWAP_MODE",
|
||||
"SYMBOL_SWAP_ROLLOVER3DAYS",
|
||||
"SYMBOL_EXPIRATION_MODE",
|
||||
"SYMBOL_FILLING_MODE",
|
||||
"SYMBOL_ORDER_MODE"});
|
||||
this.comboBox4.Location = new System.Drawing.Point(10, 87);
|
||||
this.comboBox4.Name = "comboBox4";
|
||||
this.comboBox4.Size = new System.Drawing.Size(174, 21);
|
||||
this.comboBox4.TabIndex = 3;
|
||||
//
|
||||
// button32
|
||||
//
|
||||
this.button32.Location = new System.Drawing.Point(190, 87);
|
||||
this.button32.Name = "button32";
|
||||
this.button32.Size = new System.Drawing.Size(108, 23);
|
||||
this.button32.TabIndex = 2;
|
||||
this.button32.Text = "SymbolInfoInteger";
|
||||
this.button32.UseVisualStyleBackColor = true;
|
||||
this.button32.Click += new System.EventHandler(this.button32_Click);
|
||||
//
|
||||
// button30
|
||||
//
|
||||
this.button30.Location = new System.Drawing.Point(206, 56);
|
||||
this.button30.Name = "button30";
|
||||
this.button30.Size = new System.Drawing.Size(92, 23);
|
||||
this.button30.TabIndex = 2;
|
||||
this.button30.Text = "SymbolSelect";
|
||||
this.button30.UseVisualStyleBackColor = true;
|
||||
this.button30.Click += new System.EventHandler(this.button30_Click);
|
||||
//
|
||||
// button29
|
||||
//
|
||||
this.button29.Location = new System.Drawing.Point(108, 56);
|
||||
this.button29.Name = "button29";
|
||||
this.button29.Size = new System.Drawing.Size(92, 23);
|
||||
this.button29.TabIndex = 2;
|
||||
this.button29.Text = "SymbolName";
|
||||
this.button29.UseVisualStyleBackColor = true;
|
||||
this.button29.Click += new System.EventHandler(this.button29_Click);
|
||||
//
|
||||
// button28
|
||||
//
|
||||
this.button28.Location = new System.Drawing.Point(10, 56);
|
||||
this.button28.Name = "button28";
|
||||
this.button28.Size = new System.Drawing.Size(92, 23);
|
||||
this.button28.TabIndex = 2;
|
||||
this.button28.Text = "SymbolsTotal";
|
||||
this.button28.UseVisualStyleBackColor = true;
|
||||
this.button28.Click += new System.EventHandler(this.button28_Click);
|
||||
//
|
||||
// label28
|
||||
//
|
||||
this.label28.AutoSize = true;
|
||||
this.label28.Location = new System.Drawing.Point(7, 20);
|
||||
this.label28.Name = "label28";
|
||||
this.label28.Size = new System.Drawing.Size(41, 13);
|
||||
this.label28.TabIndex = 1;
|
||||
this.label28.Text = "Symbol";
|
||||
//
|
||||
// textBox1
|
||||
//
|
||||
this.textBox1.Location = new System.Drawing.Point(54, 17);
|
||||
this.textBox1.Name = "textBox1";
|
||||
this.textBox1.Size = new System.Drawing.Size(100, 20);
|
||||
this.textBox1.TabIndex = 0;
|
||||
this.textBox1.Text = "EURUSD";
|
||||
//
|
||||
// Form1
|
||||
//
|
||||
@@ -1466,6 +1584,8 @@
|
||||
this.tabPage6.ResumeLayout(false);
|
||||
this.tabPage6.PerformLayout();
|
||||
this.tabPage7.ResumeLayout(false);
|
||||
this.tabPage8.ResumeLayout(false);
|
||||
this.tabPage8.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
@@ -1590,6 +1710,14 @@
|
||||
private System.Windows.Forms.Button button25;
|
||||
private System.Windows.Forms.Button button27;
|
||||
private System.Windows.Forms.TextBox textBoxPrint;
|
||||
private System.Windows.Forms.TabPage tabPage8;
|
||||
private System.Windows.Forms.Label label28;
|
||||
private System.Windows.Forms.TextBox textBox1;
|
||||
private System.Windows.Forms.Button button28;
|
||||
private System.Windows.Forms.Button button29;
|
||||
private System.Windows.Forms.Button button30;
|
||||
private System.Windows.Forms.Button button32;
|
||||
private System.Windows.Forms.ComboBox comboBox4;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user