mirror of
https://github.com/vdemydiuk/mtapi.git
synced 2026-07-28 11:07:48 +00:00
Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 5f4ae3cd9e | |||
| 13b8aa9644 | |||
| e364b313c3 | |||
| 68f2a7ae07 | |||
| 42a1da3356 | |||
| 44fab4dae1 | |||
| d1387148df | |||
| bb4ac426cd | |||
| 34b4e33cc9 |
@@ -31,22 +31,6 @@ public struct CMqlRates
|
||||
int spread; // Spread
|
||||
__int64 real_volume; // Trade volume
|
||||
};
|
||||
|
||||
public struct CMqlTick
|
||||
{
|
||||
__int64 time; // Time of the last prices update
|
||||
double bid; // Current Bid price
|
||||
double ask; // Current Ask price
|
||||
double last; // Price of the last deal (Last)
|
||||
unsigned __int64 volume; // Volume for the current Last price
|
||||
};
|
||||
|
||||
public struct CMqlBookInfo
|
||||
{
|
||||
int type; // Order type from ENUM_BOOK_TYPE enumeration
|
||||
double price; // Price
|
||||
__int64 volume; // Volume
|
||||
};
|
||||
#pragma pack(pop)
|
||||
|
||||
void convertSystemString(wchar_t* dest, String^ src)
|
||||
@@ -224,37 +208,6 @@ _DLLAPI int _stdcall sendMqlRatesArrayResponse(int expertHandle, CMqlRates value
|
||||
}, err, 0);
|
||||
}
|
||||
|
||||
_DLLAPI int _stdcall sendMqlTickResponse(int expertHandle, CMqlTick* response, wchar_t* err)
|
||||
{
|
||||
return Execute<int>([&expertHandle, response]() {
|
||||
MtMqlTick^ mtResponse = gcnew MtMqlTick();
|
||||
mtResponse->time = response->time;
|
||||
mtResponse->bid = response->bid;
|
||||
mtResponse->ask = response->ask;
|
||||
mtResponse->last = response->last;
|
||||
mtResponse->volume = response->volume;
|
||||
MtAdapter::GetInstance()->SendResponse(expertHandle, gcnew MtResponseMqlTick(mtResponse));
|
||||
return 1;
|
||||
}, err, 0);
|
||||
}
|
||||
|
||||
_DLLAPI int _stdcall sendMqlBookInfoArrayResponse(int expertHandle, CMqlBookInfo values[], int size, wchar_t* err)
|
||||
{
|
||||
return Execute<int>([&expertHandle, values, &size]() {
|
||||
array<MtMqlBookInfo^>^ list = gcnew array<MtMqlBookInfo^>(size);
|
||||
for (int i = 0; i < size; i++)
|
||||
{
|
||||
MtMqlBookInfo^ info = gcnew MtMqlBookInfo();
|
||||
info->type = values[i].type;
|
||||
info->price = values[i].price;
|
||||
info->volume = values[i].volume;
|
||||
list[i] = info;
|
||||
}
|
||||
MtAdapter::GetInstance()->SendResponse(expertHandle, gcnew MtResponseMqlBookInfoArray(list));
|
||||
return 1;
|
||||
}, err, 0);
|
||||
}
|
||||
|
||||
//----------- get values -------------------------------
|
||||
|
||||
_DLLAPI int _stdcall getCommandType(int expertHandle, int* res, wchar_t* err)
|
||||
|
||||
@@ -72,9 +72,7 @@
|
||||
<Compile Include="MtClient.cs" />
|
||||
<Compile Include="MtCommandTask.cs" />
|
||||
<Compile Include="MtEvent.cs" />
|
||||
<Compile Include="MtMqlBookInfo.cs" />
|
||||
<Compile Include="MtMqlRates.cs" />
|
||||
<Compile Include="MtMqlTick.cs" />
|
||||
<Compile Include="MtMqlTradeRequest.cs" />
|
||||
<Compile Include="MtRegistryManager.cs" />
|
||||
<Compile Include="MtConnectionProfile.cs" />
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace MTApiService
|
||||
{
|
||||
[DataContract]
|
||||
public class MtMqlBookInfo
|
||||
{
|
||||
[DataMember]
|
||||
public int type { get; set; }
|
||||
|
||||
[DataMember]
|
||||
public double price { get; set; }
|
||||
|
||||
[DataMember]
|
||||
public long volume { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace MTApiService
|
||||
{
|
||||
[DataContract]
|
||||
public class MtMqlTick
|
||||
{
|
||||
[DataMember]
|
||||
public long time { get; set; } // Time of the last prices update
|
||||
|
||||
[DataMember]
|
||||
public double bid { get; set; } // Current Bid price
|
||||
|
||||
[DataMember]
|
||||
public double ask { get; set; } // Current Ask price
|
||||
|
||||
[DataMember]
|
||||
public double last { get; set; } // Price of the last deal (Last)
|
||||
|
||||
[DataMember]
|
||||
public ulong volume { get; set; } // Volume for the current Last price
|
||||
}
|
||||
}
|
||||
@@ -17,9 +17,8 @@ namespace MTApiService
|
||||
typeof(MtResponseString), typeof(MtResponseBool),
|
||||
typeof(MtResponseLong), typeof(MtResponseULong),
|
||||
typeof(MtResponseDoubleArray), typeof(MtResponseIntArray),
|
||||
typeof(MtResponseLongArray), typeof(MtResponseMqlTick),
|
||||
typeof(MtResponseArrayList), typeof(MtResponseMqlRatesArray),
|
||||
typeof(MtResponseMqlBookInfoArray)};
|
||||
typeof(MtResponseLongArray),
|
||||
typeof(MtResponseArrayList), typeof(MtResponseMqlRatesArray)};
|
||||
}
|
||||
|
||||
public abstract object GetValue();
|
||||
@@ -255,43 +254,4 @@ namespace MTApiService
|
||||
return Value.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
public class MtResponseMqlTick : MtResponse
|
||||
{
|
||||
public MtResponseMqlTick(MtMqlTick value)
|
||||
{
|
||||
Value = value;
|
||||
}
|
||||
|
||||
[DataMember]
|
||||
public MtMqlTick Value { get; private set; }
|
||||
|
||||
public override object GetValue() { return Value; }
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return Value.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
public class MtResponseMqlBookInfoArray : MtResponse
|
||||
{
|
||||
public MtResponseMqlBookInfoArray(MtMqlBookInfo[] value)
|
||||
{
|
||||
Value = value;
|
||||
}
|
||||
|
||||
[DataMember]
|
||||
public MtMqlBookInfo[] Value { get; private set; }
|
||||
|
||||
public override object GetValue() { return Value; }
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return Value.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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")]
|
||||
@@ -7,6 +7,9 @@
|
||||
OP_BUYLIMIT = 2,
|
||||
OP_SELLLIMIT = 3,
|
||||
OP_BUYSTOP = 4,
|
||||
OP_SELLSTOP = 5
|
||||
OP_SELLSTOP = 5,
|
||||
OP_BALANCE = 6,
|
||||
OP_CREDIT = 7,
|
||||
OP_REBATE = 8
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ namespace MtApi5
|
||||
public ENUM_BOOK_TYPE type { get; set; } // Order type from ENUM_BOOK_TYPE enumeration
|
||||
public double price { get; set; } // Price
|
||||
public long volume { get; set; } // Volume
|
||||
public double volume_real { get; set; } // Volume for the current Last price with greater accuracy
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
|
||||
+2
-1
@@ -23,7 +23,8 @@ namespace MtApi5
|
||||
public double bid { get; set; } // Current Bid price
|
||||
public double ask { get; set; } // Current Ask price
|
||||
public double last { get; set; } // Price of the last deal (Last)
|
||||
public ulong volume { get; set; } // Volume for the current Last price
|
||||
public ulong volume { get; set; } // Volume for the current Last price
|
||||
public double volume_real { get; set; } // Volume for the current Last price with greater accuracy
|
||||
|
||||
public DateTime time => Mt5TimeConverter.ConvertFromMtTime(MtTime);
|
||||
}
|
||||
|
||||
+3
-1
@@ -223,6 +223,9 @@ namespace MtApi5
|
||||
SYMBOL_LAST = 7,
|
||||
SYMBOL_LASTHIGH = 8,
|
||||
SYMBOL_LASTLOW = 9,
|
||||
SYMBOL_VOLUME_REAL = 10,
|
||||
SYMBOL_VOLUMEHIGH_REAL = 11,
|
||||
SYMBOL_VOLUMELOW_REAL = 12,
|
||||
SYMBOL_OPTION_STRIKE = 72,
|
||||
SYMBOL_POINT = 16,
|
||||
SYMBOL_TRADE_TICK_VALUE = 26,
|
||||
@@ -548,7 +551,6 @@ namespace MtApi5
|
||||
POSITION_SL = 6, //Stop Loss level of opened position
|
||||
POSITION_TP = 7, //Take Profit level of opened position
|
||||
POSITION_PRICE_CURRENT = 5, //Current price of the position symbol
|
||||
POSITION_COMMISSION = 8, //FIXME: Undocumented!
|
||||
POSITION_SWAP = 9, //Cumulative swap
|
||||
POSITION_PROFIT = 10 //Current profit
|
||||
}
|
||||
|
||||
@@ -32,8 +32,8 @@
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Newtonsoft.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Newtonsoft.Json.8.0.3\lib\net40\Newtonsoft.Json.dll</HintPath>
|
||||
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Newtonsoft.Json.12.0.2\lib\net40\Newtonsoft.Json.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
@@ -98,6 +98,7 @@
|
||||
<Compile Include="Requests\Response.cs" />
|
||||
<Compile Include="Requests\SymbolInfoStringRequest.cs" />
|
||||
<Compile Include="Requests\SymbolInfoStringResult.cs" />
|
||||
<Compile Include="Requests\SymbolInfoTickRequest.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\MTApiService\MTApiService.csproj">
|
||||
@@ -108,7 +109,6 @@
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
|
||||
+33
-10
@@ -1476,19 +1476,27 @@ namespace MtApi5
|
||||
///<param name="tick"> Link to the structure of the MqlTick type, to which the current prices and time of the last price update will be placed.</param>
|
||||
public bool SymbolInfoTick(string symbol, out MqlTick tick)
|
||||
{
|
||||
var commandParameters = new ArrayList { symbol };
|
||||
|
||||
var retVal = SendCommand<MtMqlTick>(Mt5CommandType.SymbolInfoTick, commandParameters);
|
||||
|
||||
tick = null;
|
||||
if (retVal != null)
|
||||
tick = SendRequest<MqlTick>(new SymbolInfoTickRequest
|
||||
{
|
||||
tick = new MqlTick { MtTime = retVal.time, ask = retVal.ask, bid = retVal.bid, last = retVal.last, volume = retVal.volume };
|
||||
}
|
||||
SymbolName = symbol
|
||||
});
|
||||
|
||||
return tick != null;
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///The function returns current prices of a specified symbol in a variable of the MqlTick type.
|
||||
///</summary>
|
||||
///<param name="symbol">Symbol name.</param>
|
||||
public MqlTick SymbolInfoTick(string symbol)
|
||||
{
|
||||
var tick = SendRequest<MqlTick>(new SymbolInfoTickRequest
|
||||
{
|
||||
SymbolName = symbol
|
||||
});
|
||||
|
||||
return tick;
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///Allows receiving time of beginning and end of the specified quoting sessions for a specified symbol and weekday.
|
||||
@@ -2086,9 +2094,24 @@ namespace MtApi5
|
||||
///<param name="nwin">Number of the chart subwindow. 0 means the main chart window. The specified subwindow must exist, otherwise the function returns false.</param>
|
||||
///<param name="time">The time coordinate of the first anchor.</param>
|
||||
///<param name="price">The price coordinate of the first anchor point.</param>
|
||||
public bool ObjectCreate(long chartId, string name, ENUM_OBJECT type, int nwin, DateTime time, double price)
|
||||
///<param name="listOfCoordinates">List of further anchor points (tuple of time and price).</param>
|
||||
public bool ObjectCreate(long chartId, string name, ENUM_OBJECT type, int nwin, DateTime time, double price, List<Tuple<DateTime, double>> listOfCoordinates = null)
|
||||
{
|
||||
var commandParameters = new ArrayList { chartId, name, (int)type, nwin, Mt5TimeConverter.ConvertToMtTime(time), price };
|
||||
//Count the additional coordinates
|
||||
int iAdditionalCoordinates = (listOfCoordinates != null) ? listOfCoordinates.Count() : 0;
|
||||
if(iAdditionalCoordinates > 29)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("listOfCoordinates", "The maximum amount of coordinates in 30.");
|
||||
}
|
||||
|
||||
int nParameter = 6 + iAdditionalCoordinates * 2;
|
||||
|
||||
var commandParameters = new ArrayList { nParameter, chartId, name, (int)type, nwin, Mt5TimeConverter.ConvertToMtTime(time), price };
|
||||
foreach (Tuple<DateTime, double> coordinateTuple in listOfCoordinates)
|
||||
{
|
||||
commandParameters.Add(Mt5TimeConverter.ConvertToMtTime(coordinateTuple.Item1));
|
||||
commandParameters.Add(coordinateTuple.Item2);
|
||||
}
|
||||
return SendCommand<bool>(Mt5CommandType.ObjectCreate, commandParameters);
|
||||
}
|
||||
|
||||
|
||||
@@ -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.19")]
|
||||
[assembly: AssemblyFileVersion("1.0.19")]
|
||||
[assembly: AssemblyVersion("1.0.20")]
|
||||
[assembly: AssemblyFileVersion("1.0.20")]
|
||||
|
||||
@@ -15,6 +15,7 @@ namespace MtApi5.Requests
|
||||
SymbolInfoString = 8,
|
||||
ChartTimePriceToXY = 9,
|
||||
ChartXYToTimePrice = 10,
|
||||
PositionClose = 11
|
||||
PositionClose = 11,
|
||||
SymbolInfoTick = 12
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace MtApi5.Requests
|
||||
{
|
||||
internal class SymbolInfoTickRequest : RequestBase
|
||||
{
|
||||
public override RequestType RequestType => RequestType.SymbolInfoTick;
|
||||
|
||||
public string SymbolName { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Newtonsoft.Json" version="8.0.3" targetFramework="net40" />
|
||||
<package id="Newtonsoft.Json" version="12.0.2" targetFramework="net40" />
|
||||
</packages>
|
||||
@@ -992,6 +992,12 @@ namespace MtApi5TestClient
|
||||
{
|
||||
var retVal = await Execute(() => _mtApiClient.SymbolInfoDouble("EURUSD", ENUM_SYMBOL_INFO_DOUBLE.SYMBOL_BID));
|
||||
AddLog($"SymbolInfoDouble(EURUSD, ENUM_SYMBOL_INFO_DOUBLE.SYMBOL_BID): result = {retVal}");
|
||||
retVal = await Execute(() => _mtApiClient.SymbolInfoDouble("EURUSD", ENUM_SYMBOL_INFO_DOUBLE.SYMBOL_VOLUME_REAL));
|
||||
AddLog($"SymbolInfoDouble(EURUSD, ENUM_SYMBOL_INFO_DOUBLE.SYMBOL_VOLUME_REAL): result = {retVal}");
|
||||
retVal = await Execute(() => _mtApiClient.SymbolInfoDouble("EURUSD", ENUM_SYMBOL_INFO_DOUBLE.SYMBOL_VOLUMEHIGH_REAL));
|
||||
AddLog($"SymbolInfoDouble(EURUSD, ENUM_SYMBOL_INFO_DOUBLE.SYMBOL_VOLUMEHIGH_REAL): result = {retVal}");
|
||||
retVal = await Execute(() => _mtApiClient.SymbolInfoDouble("EURUSD", ENUM_SYMBOL_INFO_DOUBLE.SYMBOL_VOLUMELOW_REAL));
|
||||
AddLog($"SymbolInfoDouble(EURUSD, ENUM_SYMBOL_INFO_DOUBLE.SYMBOL_VOLUMELOW_REAL): result = {retVal}");
|
||||
}
|
||||
|
||||
private async void ExecuteSymbolInfoInteger(object o)
|
||||
@@ -1030,6 +1036,7 @@ namespace MtApi5TestClient
|
||||
AddLog($"SymbolInfoTick(EURUSD) tick.ask = {result.ask}");
|
||||
AddLog($"SymbolInfoTick(EURUSD) tick.last = {result.last}");
|
||||
AddLog($"SymbolInfoTick(EURUSD) tick.volume = {result.volume}");
|
||||
AddLog($"SymbolInfoTick(EURUSD) tick.volume_real = {result.volume_real}");
|
||||
}
|
||||
|
||||
private async void ExecuteSymbolInfoSessionQuote(object o)
|
||||
@@ -1100,7 +1107,7 @@ namespace MtApi5TestClient
|
||||
|
||||
for (var i = 0; i < result.Length; i++)
|
||||
{
|
||||
AddLog($"MarketBookGet: [{i}] - {result[i].price} | {result[i].volume} | {result[i].type}");
|
||||
AddLog($"MarketBookGet: [{i}] - {result[i].price} | {result[i].volume} | {result[i].type} | {result[i].volume_real}");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Binary file not shown.
+26
-36
@@ -25,8 +25,6 @@
|
||||
bool sendULongResponse(int expertHandle, ulong response, string& err);
|
||||
bool sendLongArrayResponse(int expertHandle, long& values[], int size, string& err);
|
||||
bool sendMqlRatesArrayResponse(int expertHandle, MqlRates& values[], int size, string& err);
|
||||
bool sendMqlTickResponse(int expertHandle, MqlTick& response, string& err);
|
||||
bool sendMqlBookInfoArrayResponse(int expertHandle, MqlBookInfo& values[], int size, string& err);
|
||||
bool sendErrorResponse(int expertHandle, int code, string message, string& err);
|
||||
|
||||
bool sendEvent(int expertHandle, int eventType, string payload, string& err);
|
||||
@@ -532,9 +530,8 @@ int executeCommand()
|
||||
case 56: //SymbolInfoString
|
||||
Execute_SymbolInfoString();
|
||||
break;
|
||||
case 57: //SymbolInfoTick
|
||||
Execute_SymbolInfoTick();
|
||||
break;
|
||||
// case 57: //SymbolInfoTick
|
||||
// break;
|
||||
case 58: //SymbolInfoSessionQuote
|
||||
Execute_SymbolInfoSessionQuote();
|
||||
break;
|
||||
@@ -3150,37 +3147,6 @@ void Execute_SymbolInfoString()
|
||||
}
|
||||
}
|
||||
|
||||
void Execute_SymbolInfoTick()
|
||||
{
|
||||
string symbol;
|
||||
StringInit(symbol, 100, 0);
|
||||
|
||||
if (!getStringValue(ExpertHandle, 0, symbol, _error))
|
||||
{
|
||||
PrintParamError("SymbolInfoTick", "symbol", _error);
|
||||
sendErrorResponse(ExpertHandle, -1, _error, _response_error);
|
||||
return;
|
||||
}
|
||||
|
||||
MqlTick tick={0};
|
||||
bool ok = SymbolInfoTick(symbol, tick);
|
||||
|
||||
if (ok)
|
||||
{
|
||||
if (!sendMqlTickResponse(ExpertHandle, tick, _response_error))
|
||||
{
|
||||
PrintResponseError("SymbolInfoTick", _response_error);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!sendVoidResponse(ExpertHandle, _response_error))
|
||||
{
|
||||
PrintResponseError("SymbolInfoTick", _response_error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Execute_SymbolInfoSessionQuote()
|
||||
{
|
||||
string symbol;
|
||||
@@ -6795,6 +6761,9 @@ string OnRequest(string json)
|
||||
case 11: //PositionClose
|
||||
response = ExecuteRequest_PositionClose(jo);
|
||||
break;
|
||||
case 12: //SymbolInfoTick
|
||||
response = ExecuteRequest_SymbolInfoTick(jo);
|
||||
break;
|
||||
default:
|
||||
PrintFormat("%s [WARNING]: Unknown request type %d", __FUNCTION__, requestType);
|
||||
response = CreateErrorResponse(-1, "Unknown request type");
|
||||
@@ -7083,6 +7052,7 @@ JSONObject* MqlBookInfoToJson(MqlBookInfo& info)
|
||||
jo.put("type", new JSONNumber((int)info.type));
|
||||
jo.put("price", new JSONNumber(info.price));
|
||||
jo.put("volume", new JSONNumber(info.volume));
|
||||
jo.put("volume_real", new JSONNumber(info.volume_real));
|
||||
return jo;
|
||||
}
|
||||
|
||||
@@ -7306,6 +7276,25 @@ string ExecuteRequest_PositionClose(JSONObject *jo)
|
||||
return CreateSuccessResponse("Value", result_value_jo);
|
||||
}
|
||||
|
||||
string ExecuteRequest_SymbolInfoTick(JSONObject *jo)
|
||||
{
|
||||
CHECK_JSON_VALUE(jo, "SymbolName", CreateErrorResponse(-1, "Undefinded mandatory parameter SymbolName"));
|
||||
string symbol_name = jo.getString("SymbolName");
|
||||
|
||||
#ifdef __DEBUG_LOG__
|
||||
PrintFormat("%s: symbol_name = %s", __FUNCTION__, symbol_name);
|
||||
#endif
|
||||
|
||||
MqlTick tick={0};
|
||||
bool ok = SymbolInfoTick(symbol_name, tick);
|
||||
|
||||
#ifdef __DEBUG_LOG__
|
||||
PrintFormat("%s: ok = %s", __FUNCTION__, BoolToString(ok));
|
||||
#endif
|
||||
|
||||
return CreateSuccessResponse("Value", MqlTickToJson(tick));
|
||||
}
|
||||
|
||||
//------------ Events -------------------------------------------------------
|
||||
|
||||
enum MtEventTypes
|
||||
@@ -7537,6 +7526,7 @@ JSONObject* MqlTickToJson(MqlTick& tick)
|
||||
jo.put("ask", new JSONNumber(tick.ask));
|
||||
jo.put("last", new JSONNumber(tick.last));
|
||||
jo.put("volume", new JSONNumber(tick.volume));
|
||||
jo.put("volume_real", new JSONNumber(tick.volume_real));
|
||||
return jo;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user