Exemplo n.º 1
0
 /// <summary>
 /// Function: ObjectCreate
 /// Description: The function creates an object with the specified name, type, and the initial coordinates in the specified chart subwindow of the specified chart. There are two variants of the function:
 /// URL: http://docs.mql4.com/objects/objectcreate.html
 /// </summary>
 /// <param name="object_name">[in] Name of the object. The name must be unique within a chart, including its subwindows.</param>
 /// <param name="object_type">[in] Object type. The value can be one of the values of the enumeration.</param>
 /// <param name="sub_window">[in] Number of the chart subwindow. 0 means the main chart window. The specified subwindow must exist (window index must be greater or equal to 0 and less than ), otherwise the function returns false.</param>
 /// <param name="time1">[in] The time coordinate of the first anchor point.</param>
 /// <param name="price1">[in] The price coordinate of the first anchor point.</param>
 /// <param name="time2">[in] The time coordinate of the second anchor point.</param>
 /// <param name="price2">[in] The price coordinate of the second anchor point.</param>
 /// <param name="time3">[in] The time coordinate of the third anchor point.</param>
 /// <param name="price3">[in] The price coordinate of the third anchor point.</param>
 public bool ObjectCreate (string object_name, ENUM_OBJECT object_type, int sub_window, DateTime time1, double price1, DateTime time2, double price2, DateTime time3, double price3)
 {
     List<Object> parameters = new List<Object>();
     parameters.Add(object_name);
     parameters.Add(object_type.ToString());
     parameters.Add(sub_window);
     parameters.Add(time1);
     parameters.Add(price1);
     parameters.Add(time2);
     parameters.Add(price2);
     parameters.Add(time3);
     parameters.Add(price3);
     MQLCommandManager.getInstance().ExecCommand(MQLCommand.ObjectCreate_2, parameters); // MQLCommand ENUM = 171
     while (MQLCommandManager.getInstance().IsCommandRunning())
     {
         //Thread.Sleep(1);
     }
     MQLCommandManager.getInstance().throwExceptionIfErrorResponse();
     return (bool) MQLCommandManager.getInstance().GetCommandResult();
 }
Exemplo n.º 2
0
 /// <summary>
 /// Function: ObjectCreate
 /// Description: The function creates an object with the specified name, type, and the initial coordinates in the specified chart subwindow of the specified chart. There are two variants of the function:
 /// URL: http://mm.l/mql4/docs.mql4.com/objects/objectcreate.html
 /// </summary>
 /// <param name="chart_id">[in] Chart identifier.</param>
 /// <param name="object_name">[in] Name of the object. The name must be unique within a chart, including its subwindows.</param>
 /// <param name="object_type">[in] Object type. The value can be one of the values of the enumeration.</param>
 /// <param name="sub_window">[in] Number of the chart subwindow. 0 means the main chart window. The specified subwindow must exist (window index must be greater or equal to 0 and less than ), otherwise the function returns false.</param>
 /// <param name="time1">[in] The time coordinate of the first anchor point.</param>
 /// <param name="price1">[in] The price coordinate of the first anchor point.</param>
 /// <param name="timeN">[in] The time coordinate of the N-th anchor point.</param>
 /// <param name="priceN">[in] The price coordinate of the N-th anchor point.</param>
 public bool ObjectCreate(long chart_id, string object_name, ENUM_OBJECT object_type, int sub_window,
     DateTime time1, double price1, DateTime timeN, double priceN)
 {
     List<Object> parameters = new List<Object>();
     parameters.Add(chart_id);
     parameters.Add(object_name);
     parameters.Add(object_type.ToString());
     parameters.Add(sub_window);
     parameters.Add(time1);
     parameters.Add(price1);
     parameters.Add(timeN);
     parameters.Add(priceN);
     MQLCommandManager.getInstance().ExecCommand(MQLCommand.ObjectCreate_1, parameters); // MQLCommand ENUM = 171
     while (MQLCommandManager.getInstance().IsCommandRunning()) Thread.Sleep(1);
     return (bool) MQLCommandManager.getInstance().GetCommandResult();
 }