mirror of
https://github.com/vdemydiuk/mtapi.git
synced 2026-08-19 21:58:10 +00:00
PyMtApi5: implemented function ChartWindowFind
This commit is contained in:
@@ -61,6 +61,7 @@ class Mt5ApiApp:
|
|||||||
"ChartRedraw": self.process_chart_redraw,
|
"ChartRedraw": self.process_chart_redraw,
|
||||||
"ChartApplyTemplate": self.process_chart_apply_template,
|
"ChartApplyTemplate": self.process_chart_apply_template,
|
||||||
"ChartSaveTemplate": self.process_chart_save_template,
|
"ChartSaveTemplate": self.process_chart_save_template,
|
||||||
|
"ChartWindowFind": self.process_chart_window_find,
|
||||||
}
|
}
|
||||||
|
|
||||||
def on_disconnect(self, error_msg=None):
|
def on_disconnect(self, error_msg=None):
|
||||||
@@ -450,6 +451,14 @@ class Mt5ApiApp:
|
|||||||
result = mtapi.chart_save_template(int(pieces[0]), pieces[1])
|
result = mtapi.chart_save_template(int(pieces[0]), pieces[1])
|
||||||
print(f"> ChartSaveTemplate: response = {result}")
|
print(f"> ChartSaveTemplate: response = {result}")
|
||||||
|
|
||||||
|
def process_chart_window_find(self, mtapi, parameters):
|
||||||
|
pieces = parameters.split(" ", 1)
|
||||||
|
if len(pieces) != 2 or not pieces[0] or not pieces[1]:
|
||||||
|
print(f"! Invalid parameters for command ChartWindowFind: {parameters}")
|
||||||
|
return
|
||||||
|
result = mtapi.chart_window_find(int(pieces[0]), pieces[1])
|
||||||
|
print(f"> ChartWindowFind: response = {result}")
|
||||||
|
|
||||||
def mtapi_command_thread(self, mtapi):
|
def mtapi_command_thread(self, mtapi):
|
||||||
while mtapi.is_connected():
|
while mtapi.is_connected():
|
||||||
filename = "client.cmd"
|
filename = "client.cmd"
|
||||||
|
|||||||
@@ -474,6 +474,11 @@ class Mt5ApiClient:
|
|||||||
cmd_params = {"ChartId": chart_id, "TemplateFileName": filename}
|
cmd_params = {"ChartId": chart_id, "TemplateFileName": filename}
|
||||||
return self.__send_command(self.__get_default_expert(), Mt5CommandType.ChartSaveTemplate, cmd_params)
|
return self.__send_command(self.__get_default_expert(), Mt5CommandType.ChartSaveTemplate, cmd_params)
|
||||||
|
|
||||||
|
# ChartWindowFind
|
||||||
|
def chart_window_find(self, chart_id, indicator_short_name: str):
|
||||||
|
cmd_params = {"ChartId": chart_id, "IndicatorShortname": indicator_short_name};
|
||||||
|
return self.__send_command(self.__get_default_expert(), Mt5CommandType.ChartWindowFind, cmd_params)
|
||||||
|
|
||||||
# Private methods
|
# Private methods
|
||||||
|
|
||||||
def __event_thread_func(self):
|
def __event_thread_func(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user