mirror of
https://github.com/vdemydiuk/mtapi.git
synced 2026-08-17 12:48:11 +00:00
Added function SymbolInfoInteger into MtApi (MT4). Added function sendLongResponse into library MTConnector
This commit is contained in:
@@ -201,6 +201,20 @@ int _stdcall sendIntArrayResponse(int expertHandle, int* values, int size)
|
|||||||
return 1;
|
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)
|
int _stdcall getCommandType(int expertHandle, int* res)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ EXPORTS initExpert
|
|||||||
sendVoidResponse
|
sendVoidResponse
|
||||||
sendDoubleArrayResponse
|
sendDoubleArrayResponse
|
||||||
sendIntArrayResponse
|
sendIntArrayResponse
|
||||||
|
sendLongResponse
|
||||||
getCommandType
|
getCommandType
|
||||||
getIntValue
|
getIntValue
|
||||||
getDoubleValue
|
getDoubleValue
|
||||||
|
|||||||
@@ -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>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="ChartPeriod.cs" />
|
<Compile Include="ChartPeriod.cs" />
|
||||||
|
<Compile Include="EnumSymbolInfoInteger.cs" />
|
||||||
<Compile Include="ExtensionMethods.cs" />
|
<Compile Include="ExtensionMethods.cs" />
|
||||||
<Compile Include="Monitors\AvailabilityOrdersEventArgs.cs" />
|
<Compile Include="Monitors\AvailabilityOrdersEventArgs.cs" />
|
||||||
<Compile Include="MqlRates.cs" />
|
<Compile Include="MqlRates.cs" />
|
||||||
|
|||||||
@@ -659,23 +659,60 @@ namespace MtApi
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Symbols
|
#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)
|
public int SymbolsTotal(bool selected)
|
||||||
{
|
{
|
||||||
var commandParameters = new ArrayList { selected };
|
var commandParameters = new ArrayList { selected };
|
||||||
return SendCommand<int>(MtCommandType.SymbolsTotal, commandParameters);
|
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)
|
public string SymbolName(int pos, bool selected)
|
||||||
{
|
{
|
||||||
var commandParameters = new ArrayList { pos, selected };
|
var commandParameters = new ArrayList { pos, selected };
|
||||||
return SendCommand<string>(MtCommandType.SymbolName, commandParameters);
|
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)
|
public bool SymbolSelect(string name, bool select)
|
||||||
{
|
{
|
||||||
var commandParameters = new ArrayList { name, select };
|
var commandParameters = new ArrayList { name, select };
|
||||||
return SendCommand<bool>(MtCommandType.SymbolSelect, commandParameters);
|
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
|
#endregion
|
||||||
|
|
||||||
#region Common Function
|
#region Common Function
|
||||||
|
|||||||
@@ -200,6 +200,7 @@ namespace MtApi
|
|||||||
//Symbols
|
//Symbols
|
||||||
SymbolsTotal = 200,
|
SymbolsTotal = 200,
|
||||||
SymbolName = 201,
|
SymbolName = 201,
|
||||||
SymbolSelect = 202
|
SymbolSelect = 202,
|
||||||
|
SymbolInfoInteger = 203
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user