mirror of
https://github.com/vdemydiuk/mtapi.git
synced 2026-08-14 19:28:09 +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.Globalization;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using Microsoft.Win32;
|
||||||
|
|
||||||
namespace MtApi5TestClient
|
namespace MtApi5TestClient
|
||||||
{
|
{
|
||||||
@@ -114,17 +115,16 @@ namespace MtApi5TestClient
|
|||||||
|
|
||||||
var MT5Path = _mtApiClient.TerminalInfoString(ENUM_TERMINAL_INFO_STRING.TERMINAL_PATH);
|
var MT5Path = _mtApiClient.TerminalInfoString(ENUM_TERMINAL_INFO_STRING.TERMINAL_PATH);
|
||||||
|
|
||||||
var TemplateName = "\\Files\\aa.tpl";
|
OpenFileDialog openFileDialog = new OpenFileDialog();
|
||||||
var TemplateStringContent = File.ReadAllLines("d:\\template_name.tpl");
|
openFileDialog.Filter = "Template File (*.tpl)|*.tpl|All files (*.*)|*.*";
|
||||||
|
if (openFileDialog.ShowDialog() == true)
|
||||||
|
{
|
||||||
File.WriteAllLines($"{MT5Path}\\MQL5{TemplateName}", TemplateStringContent);
|
var TemplateName = "\\Files\\mt5api_copy.tpl";
|
||||||
|
var TemplateStringContent = File.ReadAllLines(openFileDialog.FileName);
|
||||||
|
File.WriteAllLines($"{MT5Path}\\MQL5{TemplateName}", TemplateStringContent);
|
||||||
AddLog($"path: {MT5Path}");
|
AddLog($"path: {MT5Path}");
|
||||||
_mtApiClient.ChartApplyTemplate(ChartId, TemplateName);
|
_mtApiClient.ChartApplyTemplate(ChartId, TemplateName);
|
||||||
//var Applytemplate = _mtApiClient.ChartApplyTemplate(ChartId, "/")
|
}
|
||||||
|
|
||||||
return ChartId;
|
return ChartId;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -710,10 +710,26 @@ int executeCommand()
|
|||||||
Execute_ChartOpen();
|
Execute_ChartOpen();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 242: //ChartFirst
|
||||||
|
Execute_ChartFirst();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 243: //ChartFirst
|
||||||
|
Execute_ChartNext();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 245: //ChartFirst
|
||||||
|
Execute_ChartSymbol();
|
||||||
|
break;
|
||||||
|
|
||||||
case 236: //ChartApplyTemplate
|
case 236: //ChartApplyTemplate
|
||||||
Execute_ChartApplyTemplate();
|
Execute_ChartApplyTemplate();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 252: //ChartGetString
|
||||||
|
Execute_ChartGetString();
|
||||||
|
break;
|
||||||
|
|
||||||
case 153: //TerminalInfoString
|
case 153: //TerminalInfoString
|
||||||
Execute_TerminalInfoString();
|
Execute_TerminalInfoString();
|
||||||
break;
|
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()
|
void Execute_ChartApplyTemplate()
|
||||||
{
|
{
|
||||||
long ChartId;
|
long ChartId;
|
||||||
@@ -6051,6 +6110,30 @@ void Execute_ChartApplyTemplate()
|
|||||||
ChartRedraw(ChartId);
|
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()
|
void Execute_TerminalInfoString()
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user