Started version 1.0.25. Added OrderModifyRequest. Changed function OrderModify to use request pattern.

This commit is contained in:
DW
2016-05-06 10:30:51 +03:00
parent 4511a64a39
commit 1ef3765d68
14 changed files with 214 additions and 87 deletions
+13
View File
@@ -128,6 +128,7 @@
this.textBoxOppositeTicket = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label();
this.button21 = new System.Windows.Forms.Button();
this.button22 = new System.Windows.Forms.Button();
this.groupBox1.SuspendLayout();
this.statusStrip1.SuspendLayout();
this.groupBox2.SuspendLayout();
@@ -308,6 +309,7 @@
//
// tabPage2
//
this.tabPage2.Controls.Add(this.button22);
this.tabPage2.Controls.Add(this.button21);
this.tabPage2.Controls.Add(this.label3);
this.tabPage2.Controls.Add(this.textBoxOppositeTicket);
@@ -1228,6 +1230,16 @@
this.button21.UseVisualStyleBackColor = true;
this.button21.Click += new System.EventHandler(this.button21_Click);
//
// button22
//
this.button22.Location = new System.Drawing.Point(216, 293);
this.button22.Name = "button22";
this.button22.Size = new System.Drawing.Size(75, 23);
this.button22.TabIndex = 19;
this.button22.Text = "OrderModify";
this.button22.UseVisualStyleBackColor = true;
this.button22.Click += new System.EventHandler(this.button22_Click);
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@@ -1368,6 +1380,7 @@
private System.Windows.Forms.TextBox textBoxOppositeTicket;
private System.Windows.Forms.Button button15;
private System.Windows.Forms.Button button21;
private System.Windows.Forms.Button button22;
}
}
+28 -5
View File
@@ -57,7 +57,10 @@ namespace TestApiClientUI
private void RunOnUiThread(Action action)
{
this.BeginInvoke(action);
if (!IsDisposed)
{
this.BeginInvoke(action);
}
}
private void apiClient_ConnectionStateChanged(object sender, MtConnectionEventArgs e)
@@ -875,8 +878,8 @@ namespace TestApiClientUI
{
var result =
string.Format(
"Order: Ticket = {0}, Symbol = {1}, Operation = {2}, OpenPrice = {3}, ClosePrice = {4}, Lots = {5}, Profit = {6}, Comment = {7}, Commission = {8}, MagicNumber = {9}, OpenTime = {10}, CloseTime = {11}, Swap = {12}",
order.Ticket, order.Symbol, order.Operation, order.OpenPrice, order.ClosePrice, order.Lots, order.Profit, order.Comment, order.Commission, order.MagicNumber, order.OpenTime, order.CloseTime, order.Swap);
"Order: Ticket = {0}, Symbol = {1}, Operation = {2}, OpenPrice = {3}, ClosePrice = {4}, Lots = {5}, Profit = {6}, Comment = {7}, Commission = {8}, MagicNumber = {9}, OpenTime = {10}, CloseTime = {11}, Swap = {12}, Expiration = {13}",
order.Ticket, order.Symbol, order.Operation, order.OpenPrice, order.ClosePrice, order.Lots, order.Profit, order.Comment, order.Commission, order.MagicNumber, order.OpenTime, order.CloseTime, order.Swap, order.Expiration);
AddToLog(result);
}
}
@@ -895,8 +898,8 @@ namespace TestApiClientUI
{
var result =
string.Format(
"Order: Ticket = {0}, Symbol = {1}, Operation = {2}, OpenPrice = {3}, ClosePrice = {4}, Lots = {5}, Profit = {6}, Comment = {7}, Commission = {8}, MagicNumber = {9}, OpenTime = {10}, CloseTime = {11}, Swap = {12}",
order.Ticket, order.Symbol, order.Operation, order.OpenPrice, order.ClosePrice, order.Lots, order.Profit, order.Comment, order.Commission, order.MagicNumber, order.OpenTime, order.CloseTime, order.Swap);
"Order: Ticket = {0}, Symbol = {1}, Operation = {2}, OpenPrice = {3}, ClosePrice = {4}, Lots = {5}, Profit = {6}, Comment = {7}, Commission = {8}, MagicNumber = {9}, OpenTime = {10}, CloseTime = {11}, Swap = {12}, Expiration = {13}",
order.Ticket, order.Symbol, order.Operation, order.OpenPrice, order.ClosePrice, order.Lots, order.Profit, order.Comment, order.Commission, order.MagicNumber, order.OpenTime, order.CloseTime, order.Swap, order.Expiration);
AddToLog(result);
}
}
@@ -979,5 +982,25 @@ namespace TestApiClientUI
AddToLog(string.Format("Delete order result: {0}, ticket = {1}", deleted, ticket));
}
private async void button22_Click(object sender, EventArgs e)
{
var ticket = int.Parse(textBoxIndexTicket.Text);
double price;
double.TryParse(textBoxOrderPrice.Text, out price);
double stoploss;
double.TryParse(textBoxOrderStoploss.Text, out stoploss);
double takeprofit;
double.TryParse(textBoxOrderProffit.Text, out takeprofit);
var expiration = DateTime.MinValue;
var modified = await Execute(() => _apiClient.OrderModify(ticket, price, stoploss, takeprofit, expiration));
AddToLog(string.Format("Modify order result: {0}, ticket = {1}", modified, ticket));
}
}
}