mirror of
https://github.com/vdemydiuk/mtapi.git
synced 2026-08-16 12:18:09 +00:00
PyMtApi5: implemented function ChartSetInteger
This commit is contained in:
@@ -71,6 +71,7 @@ class Mt5ApiApp:
|
|||||||
"ChartSymbol": self.process_chart_symbol,
|
"ChartSymbol": self.process_chart_symbol,
|
||||||
"ChartPeriod": self.process_chart_period,
|
"ChartPeriod": self.process_chart_period,
|
||||||
"ChartSetDouble": self.process_chart_set_double,
|
"ChartSetDouble": self.process_chart_set_double,
|
||||||
|
"ChartSetInteger": self.process_chart_set_integer,
|
||||||
}
|
}
|
||||||
|
|
||||||
def on_disconnect(self, error_msg=None):
|
def on_disconnect(self, error_msg=None):
|
||||||
@@ -525,6 +526,15 @@ class Mt5ApiApp:
|
|||||||
result = mtapi.chart_set_double(int(pieces[0]), prop_id, float(pieces[2]))
|
result = mtapi.chart_set_double(int(pieces[0]), prop_id, float(pieces[2]))
|
||||||
print(f"> ChartSetDouble: response = {result}")
|
print(f"> ChartSetDouble: response = {result}")
|
||||||
|
|
||||||
|
def process_chart_set_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 ChartSetInteger: {parameters}")
|
||||||
|
return
|
||||||
|
prop_id = mt5enums.ENUM_CHART_PROPERTY_INTEGER(int(pieces[1]))
|
||||||
|
result = mtapi.chart_set_integer(int(pieces[0]), prop_id, float(pieces[2]))
|
||||||
|
print(f"> ChartSetInteger: 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"
|
||||||
|
|||||||
@@ -529,6 +529,11 @@ class Mt5ApiClient:
|
|||||||
cmd_params = {"ChartId": chart_id, "PropId": prop_id, "Value": value}
|
cmd_params = {"ChartId": chart_id, "PropId": prop_id, "Value": value}
|
||||||
return self.__send_command(self.__get_default_expert(), Mt5CommandType.ChartSetDouble, cmd_params)
|
return self.__send_command(self.__get_default_expert(), Mt5CommandType.ChartSetDouble, cmd_params)
|
||||||
|
|
||||||
|
# ChartSetInteger
|
||||||
|
def chart_set_integer(self, chart_id, prop_id: ENUM_CHART_PROPERTY_INTEGER, value):
|
||||||
|
cmd_params = {"ChartId": chart_id, "PropId": prop_id, "Value": value}
|
||||||
|
return self.__send_command(self.__get_default_expert(), Mt5CommandType.ChartSetInteger, cmd_params)
|
||||||
|
|
||||||
# Private methods
|
# Private methods
|
||||||
|
|
||||||
def __event_thread_func(self):
|
def __event_thread_func(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user