diff --git a/PyMtApi5/client.py b/PyMtApi5/client.py index 9224d8bb..2d3b05d8 100644 --- a/PyMtApi5/client.py +++ b/PyMtApi5/client.py @@ -74,6 +74,7 @@ class Mt5ApiApp: "ChartSetInteger": self.process_chart_set_integer, "ChartSetString": self.process_chart_set_string, "ChartGetDouble": self.process_chart_get_double, + "ChartGetInteger": self.process_chart_get_integer, } def on_disconnect(self, error_msg=None): @@ -555,6 +556,15 @@ class Mt5ApiApp: result = mtapi.chart_get_double(int(pieces[0]), prop_id, int(pieces[2])) print(f"> ChartGetDouble: response = {result}") + def process_chart_get_integer(self, mtapi, parameters): + pieces = parameters.split(" ", 2) + if len(pieces) != 3 or not pieces[0] or not pieces[1] or not pieces[2]: + print(f"! Invalid parameters for command ChartGetInteger: {parameters}") + return + prop_id = mt5enums.ENUM_CHART_PROPERTY_INTEGER(int(pieces[1])) + result = mtapi.chart_get_integer(int(pieces[0]), prop_id, int(pieces[2])) + print(f"> ChartGetInteger: response = {result}") + def mtapi_command_thread(self, mtapi): while mtapi.is_connected(): filename = "client.cmd" diff --git a/PyMtApi5/mt5apiclient.py b/PyMtApi5/mt5apiclient.py index 5d84ba37..22ef3bd0 100644 --- a/PyMtApi5/mt5apiclient.py +++ b/PyMtApi5/mt5apiclient.py @@ -546,6 +546,11 @@ class Mt5ApiClient: cmd_params = {"ChartId": chart_id, "PropId": prop_id, "SubWindow": sub_window} return self.__send_command(self.__get_default_expert(), Mt5CommandType.ChartGetDouble, cmd_params) + # ChartGetInteger + def chart_get_integer(self, chart_id, prop_id: ENUM_CHART_PROPERTY_INTEGER, sub_window=0): + cmd_params = {"ChartId": chart_id, "PropId": prop_id, "SubWindow": sub_window} + return self.__send_command(self.__get_default_expert(), Mt5CommandType.ChartGetInteger, cmd_params) + # Private methods def __event_thread_func(self):