mirror of
https://github.com/vdemydiuk/mtapi.git
synced 2026-08-19 21:58:10 +00:00
Implemented function ChartNavigate (MT5)
This commit is contained in:
@@ -117,6 +117,12 @@ namespace MtApi5
|
|||||||
CHART_SCRIPT_NAME = 114
|
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
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@@ -1791,9 +1791,9 @@ namespace MtApi5
|
|||||||
///<returns>
|
///<returns>
|
||||||
///Returns true if successful, otherwise returns false.
|
///Returns true if successful, otherwise returns false.
|
||||||
///</returns>
|
///</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);
|
return SendCommand<bool>(Mt5CommandType.ChartNavigate, commandParameters);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
+50
-25
@@ -774,6 +774,9 @@ int executeCommand()
|
|||||||
case 252: //ChartGetString
|
case 252: //ChartGetString
|
||||||
Execute_ChartGetString();
|
Execute_ChartGetString();
|
||||||
break;
|
break;
|
||||||
|
case 253: //ChartNavigate
|
||||||
|
Execute_ChartNavigate();
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
Print("Unknown command type = ", commandType);
|
Print("Unknown command type = ", commandType);
|
||||||
sendVoidResponse(ExpertHandle, _response_error);
|
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_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_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_DOUBLE_RESPONSE(response) SEND_RESPONSE_OR_PRINT_ERROR(sendDoubleResponse, response, __FUNCTION__)
|
||||||
|
#define SEND_STRING_RESPONSE(response) SEND_RESPONSE_OR_PRINT_ERROR(sendStringResponse, response, __FUNCTION__)
|
||||||
|
|
||||||
//-------------------------------------------------------------
|
//-------------------------------------------------------------
|
||||||
|
|
||||||
@@ -5845,6 +5849,52 @@ void Execute_ChartGetInteger()
|
|||||||
SEND_LONG_RESPONSE(result)
|
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()
|
void Execute_ChartApplyTemplate()
|
||||||
{
|
{
|
||||||
long ChartId;
|
long ChartId;
|
||||||
@@ -5923,31 +5973,6 @@ void Execute_ChartWindowFind()
|
|||||||
SEND_INT_RESPONSE(result)
|
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()
|
void Execute_TerminalInfoString()
|
||||||
{
|
{
|
||||||
int propertyId;
|
int propertyId;
|
||||||
|
|||||||
Reference in New Issue
Block a user