mirror of
https://github.com/vdemydiuk/mtapi.git
synced 2026-08-22 07:08:16 +00:00
- Correction of Test Client
- Missing codes in mtapi5.mq5
This commit is contained in:
@@ -8,6 +8,7 @@ using System.Collections.ObjectModel;
|
||||
using System.Globalization;
|
||||
using System.Threading.Tasks;
|
||||
using System.IO;
|
||||
using Microsoft.Win32;
|
||||
|
||||
namespace MtApi5TestClient
|
||||
{
|
||||
@@ -114,17 +115,16 @@ namespace MtApi5TestClient
|
||||
|
||||
var MT5Path = _mtApiClient.TerminalInfoString(ENUM_TERMINAL_INFO_STRING.TERMINAL_PATH);
|
||||
|
||||
var TemplateName = "\\Files\\aa.tpl";
|
||||
var TemplateStringContent = File.ReadAllLines("d:\\template_name.tpl");
|
||||
|
||||
|
||||
File.WriteAllLines($"{MT5Path}\\MQL5{TemplateName}", TemplateStringContent);
|
||||
|
||||
|
||||
AddLog($"path: {MT5Path}");
|
||||
_mtApiClient.ChartApplyTemplate(ChartId, TemplateName);
|
||||
//var Applytemplate = _mtApiClient.ChartApplyTemplate(ChartId, "/")
|
||||
|
||||
OpenFileDialog openFileDialog = new OpenFileDialog();
|
||||
openFileDialog.Filter = "Template File (*.tpl)|*.tpl|All files (*.*)|*.*";
|
||||
if (openFileDialog.ShowDialog() == true)
|
||||
{
|
||||
var TemplateName = "\\Files\\mt5api_copy.tpl";
|
||||
var TemplateStringContent = File.ReadAllLines(openFileDialog.FileName);
|
||||
File.WriteAllLines($"{MT5Path}\\MQL5{TemplateName}", TemplateStringContent);
|
||||
AddLog($"path: {MT5Path}");
|
||||
_mtApiClient.ChartApplyTemplate(ChartId, TemplateName);
|
||||
}
|
||||
return ChartId;
|
||||
});
|
||||
|
||||
|
||||
@@ -710,10 +710,26 @@ int executeCommand()
|
||||
Execute_ChartOpen();
|
||||
break;
|
||||
|
||||
case 242: //ChartFirst
|
||||
Execute_ChartFirst();
|
||||
break;
|
||||
|
||||
case 243: //ChartFirst
|
||||
Execute_ChartNext();
|
||||
break;
|
||||
|
||||
case 245: //ChartFirst
|
||||
Execute_ChartSymbol();
|
||||
break;
|
||||
|
||||
case 236: //ChartApplyTemplate
|
||||
Execute_ChartApplyTemplate();
|
||||
break;
|
||||
|
||||
case 252: //ChartGetString
|
||||
Execute_ChartGetString();
|
||||
break;
|
||||
|
||||
case 153: //TerminalInfoString
|
||||
Execute_TerminalInfoString();
|
||||
break;
|
||||
@@ -6022,6 +6038,49 @@ void Execute_ChartOpen()
|
||||
}
|
||||
}
|
||||
|
||||
void Execute_ChartFirst()
|
||||
{
|
||||
if (!sendLongResponse(ExpertHandle, ChartFirst(), _response_error))
|
||||
{
|
||||
PrintResponseError("ChartFirst", _response_error);
|
||||
}
|
||||
}
|
||||
|
||||
void Execute_ChartNext()
|
||||
{
|
||||
long ChartId;
|
||||
|
||||
if (!getLongValue(ExpertHandle, 0, ChartId, _error))
|
||||
{
|
||||
PrintParamError("ChartFirst", "ChartId", _error);
|
||||
sendErrorResponse(ExpertHandle, -1, _error, _response_error);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!sendLongResponse(ExpertHandle, ChartNext(ChartId), _response_error))
|
||||
{
|
||||
PrintResponseError("ChartFirst", _response_error);
|
||||
}
|
||||
}
|
||||
|
||||
void Execute_ChartSymbol()
|
||||
{
|
||||
long ChartId;
|
||||
|
||||
if (!getLongValue(ExpertHandle, 0, ChartId, _error))
|
||||
{
|
||||
PrintParamError("ChartSymbol", "ChartId", _error);
|
||||
sendErrorResponse(ExpertHandle, -1, _error, _response_error);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!sendStringResponse(ExpertHandle, ChartSymbol(ChartId), _response_error))
|
||||
{
|
||||
PrintResponseError("ChartSymbol", _response_error);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Execute_ChartApplyTemplate()
|
||||
{
|
||||
long ChartId;
|
||||
@@ -6051,6 +6110,30 @@ void Execute_ChartApplyTemplate()
|
||||
ChartRedraw(ChartId);
|
||||
}
|
||||
|
||||
void Execute_ChartGetString()
|
||||
{
|
||||
long ChartId;
|
||||
int PropId;
|
||||
|
||||
if (!getLongValue(ExpertHandle, 0, ChartId, _error))
|
||||
{
|
||||
PrintParamError("ChartGetString", "ChartId", _error);
|
||||
sendErrorResponse(ExpertHandle, -1, _error, _response_error);
|
||||
return;
|
||||
}
|
||||
if (!getIntValue(ExpertHandle, 1, PropId, _error))
|
||||
{
|
||||
PrintParamError("ChartGetString", "PropId", _error);
|
||||
sendErrorResponse(ExpertHandle, -1, _error, _response_error);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!sendStringResponse(ExpertHandle, ChartGetString(ChartId, (ENUM_CHART_PROPERTY_STRING)PropId), _response_error))
|
||||
{
|
||||
PrintResponseError("ChartGetString", _response_error);
|
||||
}
|
||||
ChartRedraw(ChartId);
|
||||
}
|
||||
|
||||
void Execute_TerminalInfoString()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user