mirror of
https://github.com/vdemydiuk/mtapi.git
synced 2026-07-27 18:47:55 +00:00
Implemented function ChartNavigate (MT5)
This commit is contained in:
+9
-3
@@ -112,11 +112,17 @@ namespace MtApi5
|
||||
|
||||
public enum ENUM_CHART_PROPERTY_STRING
|
||||
{
|
||||
CHART_COMMENT = 20,
|
||||
CHART_EXPERT_NAME = 113,
|
||||
CHART_SCRIPT_NAME = 114
|
||||
CHART_COMMENT = 20,
|
||||
CHART_EXPERT_NAME = 113,
|
||||
CHART_SCRIPT_NAME = 114
|
||||
}
|
||||
|
||||
public enum ENUM_CHART_POSITION
|
||||
{
|
||||
CHART_BEGIN = 0, // Chart beginning (the oldest prices)
|
||||
CHART_CURRENT_POS = 1, // Current position
|
||||
CHART_END = 2 // Chart end (the latest prices)
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -1791,9 +1791,9 @@ namespace MtApi5
|
||||
///<returns>
|
||||
///Returns true if successful, otherwise returns false.
|
||||
///</returns>
|
||||
public bool ChartNavigate(long chartId, int position, int shift = 0)
|
||||
public bool ChartNavigate(long chartId, ENUM_CHART_POSITION position, int shift = 0)
|
||||
{
|
||||
var commandParameters = new ArrayList { chartId, position, shift };
|
||||
var commandParameters = new ArrayList { chartId, (int)position, shift };
|
||||
return SendCommand<bool>(Mt5CommandType.ChartNavigate, commandParameters);
|
||||
}
|
||||
|
||||
|
||||
Binary file not shown.
+51
-26
@@ -774,6 +774,9 @@ int executeCommand()
|
||||
case 252: //ChartGetString
|
||||
Execute_ChartGetString();
|
||||
break;
|
||||
case 253: //ChartNavigate
|
||||
Execute_ChartNavigate();
|
||||
break;
|
||||
default:
|
||||
Print("Unknown command type = ", commandType);
|
||||
sendVoidResponse(ExpertHandle, _response_error);
|
||||
@@ -812,6 +815,7 @@ int executeCommand()
|
||||
#define SEND_ULONG_RESPONSE(response) SEND_RESPONSE_OR_PRINT_ERROR(sendULongResponse, response, __FUNCTION__)
|
||||
#define SEND_BOOL_RESPONSE(response) SEND_RESPONSE_OR_PRINT_ERROR(sendBooleanResponse, response, __FUNCTION__)
|
||||
#define SEND_DOUBLE_RESPONSE(response) SEND_RESPONSE_OR_PRINT_ERROR(sendDoubleResponse, response, __FUNCTION__)
|
||||
#define SEND_STRING_RESPONSE(response) SEND_RESPONSE_OR_PRINT_ERROR(sendStringResponse, response, __FUNCTION__)
|
||||
|
||||
//-------------------------------------------------------------
|
||||
|
||||
@@ -5824,7 +5828,7 @@ void Execute_ChartGetDouble()
|
||||
|
||||
void Execute_ChartGetInteger()
|
||||
{
|
||||
long chart_id;
|
||||
long chart_id;
|
||||
int prop_id;
|
||||
int sub_window;
|
||||
|
||||
@@ -5845,6 +5849,52 @@ void Execute_ChartGetInteger()
|
||||
SEND_LONG_RESPONSE(result)
|
||||
}
|
||||
|
||||
void Execute_ChartGetString()
|
||||
{
|
||||
long chart_id;
|
||||
int prop_id;
|
||||
|
||||
GET_LONG_VALUE(0, chart_id, "chart_id")
|
||||
GET_INT_VALUE(1, prop_id, "prop_id")
|
||||
|
||||
#ifdef __DEBUG_LOG__
|
||||
PrintFormat("%s: chart_id = %d, prop_id = %d", __FUNCTION__, chart_id, prop_id);
|
||||
#endif
|
||||
|
||||
string result = ChartGetString(chart_id, (ENUM_CHART_PROPERTY_STRING)prop_id);
|
||||
|
||||
#ifdef __DEBUG_LOG__
|
||||
PrintFormat("%s: result = %s", __FUNCTION__, result);
|
||||
#endif
|
||||
|
||||
SEND_STRING_RESPONSE(result)
|
||||
|
||||
ChartRedraw(chart_id);
|
||||
}
|
||||
|
||||
void Execute_ChartNavigate()
|
||||
{
|
||||
long chart_id;
|
||||
int position;
|
||||
int shift;
|
||||
|
||||
GET_LONG_VALUE(0, chart_id, "chart_id")
|
||||
GET_INT_VALUE(1, position, "position")
|
||||
GET_INT_VALUE(2, shift, "shift")
|
||||
|
||||
#ifdef __DEBUG_LOG__
|
||||
PrintFormat("%s: chart_id = %d, position = %d, shift = %d", __FUNCTION__, chart_id, position, shift);
|
||||
#endif
|
||||
|
||||
bool result = ChartNavigate(chart_id, (ENUM_CHART_POSITION)position, shift);
|
||||
|
||||
#ifdef __DEBUG_LOG__
|
||||
PrintFormat("%s: result = %s", __FUNCTION__, BoolToString(result));
|
||||
#endif
|
||||
|
||||
SEND_BOOL_RESPONSE(result)
|
||||
}
|
||||
|
||||
void Execute_ChartApplyTemplate()
|
||||
{
|
||||
long ChartId;
|
||||
@@ -5923,31 +5973,6 @@ void Execute_ChartWindowFind()
|
||||
SEND_INT_RESPONSE(result)
|
||||
}
|
||||
|
||||
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()
|
||||
{
|
||||
int propertyId;
|
||||
|
||||
Reference in New Issue
Block a user