Compare commits

...
9 changed files with 183 additions and 68 deletions
+10 -2
View File
@@ -62,8 +62,16 @@ namespace MTApiService
} }
//init local pipe host //init local pipe host
var localUrl = CreateConnectionAddress(null, port, true); var localPipeUrl = CreateConnectionAddress(null, port, true);
var localServiceHost = CreateServiceHost(localUrl, true); var localPipeServiceHost = CreateServiceHost(localPipeUrl, true);
if (localPipeServiceHost != null)
{
_hosts.Add(localPipeServiceHost);
}
//init localhost
var localUrl = CreateConnectionAddress("localhost", port, false);
var localServiceHost = CreateServiceHost(localUrl, false);
if (localServiceHost != null) if (localServiceHost != null)
{ {
_hosts.Add(localServiceHost); _hosts.Add(localServiceHost);
+2 -2
View File
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.26.0")] [assembly: AssemblyVersion("1.0.27.0")]
[assembly: AssemblyFileVersion("1.0.26.0")] [assembly: AssemblyFileVersion("1.0.27.0")]
+60 -5
View File
@@ -271,31 +271,77 @@ namespace MtApi
public int OrderSend(string symbol, TradeOperation cmd, double volume, double price, int slippage, double stoploss, double takeprofit public int OrderSend(string symbol, TradeOperation cmd, double volume, double price, int slippage, double stoploss, double takeprofit
, string comment, int magic, DateTime expiration) , string comment, int magic, DateTime expiration)
{ {
return OrderSend(symbol, cmd, volume, price, slippage, stoploss, takeprofit, comment, magic, expiration, Color.Empty); var response = SendRequest<OrderSendResponse>(new OrderSendRequest
{
Symbol = symbol,
Cmd = (int)cmd,
Volume = volume,
Price = price,
Slippage = slippage,
Stoploss = stoploss,
Takeprofit = takeprofit,
Comment = comment,
Magic = magic,
Expiration = MtApiTimeConverter.ConvertToMtTime(expiration)
});
return response?.Ticket ?? -1;
} }
public int OrderSend(string symbol, TradeOperation cmd, double volume, double price, int slippage, double stoploss, double takeprofit public int OrderSend(string symbol, TradeOperation cmd, double volume, double price, int slippage, double stoploss, double takeprofit
, string comment, int magic) , string comment, int magic)
{ {
return OrderSend(symbol, cmd, volume, price, slippage, stoploss, takeprofit, comment, magic, DateTime.MinValue, Color.Empty); var response = SendRequest<OrderSendResponse>(new OrderSendRequest
{
Symbol = symbol,
Cmd = (int)cmd,
Volume = volume,
Price = price,
Slippage = slippage,
Stoploss = stoploss,
Takeprofit = takeprofit,
Comment = comment,
Magic = magic
});
return response?.Ticket ?? -1;
} }
public int OrderSend(string symbol, TradeOperation cmd, double volume, double price, int slippage, double stoploss, double takeprofit public int OrderSend(string symbol, TradeOperation cmd, double volume, double price, int slippage, double stoploss, double takeprofit
, string comment) , string comment)
{ {
return OrderSend(symbol, cmd, volume, price, slippage, stoploss, takeprofit, comment, 0, DateTime.MinValue, Color.Empty); var response = SendRequest<OrderSendResponse>(new OrderSendRequest
{
Symbol = symbol,
Cmd = (int)cmd,
Volume = volume,
Price = price,
Slippage = slippage,
Stoploss = stoploss,
Takeprofit = takeprofit,
Comment = comment
});
return response?.Ticket ?? -1;
} }
public int OrderSend(string symbol, TradeOperation cmd, double volume, double price, int slippage, double stoploss, double takeprofit) public int OrderSend(string symbol, TradeOperation cmd, double volume, double price, int slippage, double stoploss, double takeprofit)
{ {
return OrderSend(symbol, cmd, volume, price, slippage, stoploss, takeprofit, null, 0, DateTime.MinValue, Color.Empty); var response = SendRequest<OrderSendResponse>(new OrderSendRequest
{
Symbol = symbol,
Cmd = (int)cmd,
Volume = volume,
Price = price,
Slippage = slippage,
Stoploss = stoploss,
Takeprofit = takeprofit,
});
return response?.Ticket ?? -1;
} }
public int OrderSend(string symbol, TradeOperation cmd, double volume, string price, int slippage, double stoploss, double takeprofit) public int OrderSend(string symbol, TradeOperation cmd, double volume, string price, int slippage, double stoploss, double takeprofit)
{ {
double dPrice; double dPrice;
return double.TryParse(price, out dPrice) ? return double.TryParse(price, out dPrice) ?
OrderSend(symbol, cmd, volume, dPrice, slippage, stoploss, takeprofit, null, 0, DateTime.MinValue, Color.Empty) : 0; OrderSend(symbol, cmd, volume, dPrice, slippage, stoploss, takeprofit) : 0;
} }
public int OrderSendBuy(string symbol, double volume, int slippage) public int OrderSendBuy(string symbol, double volume, int slippage)
@@ -2186,6 +2232,15 @@ namespace MtApi
#endregion #endregion
#region Backtesting functions
public void UnlockTicks()
{
SendCommand<object>(MtCommandType.UnlockTicks, null);
}
#endregion
#region Private Methods #region Private Methods
private MtClient Client private MtClient Client
{ {
+3 -1
View File
@@ -227,6 +227,8 @@
ObjectSet = 231, ObjectSet = 231,
ObjectSetFiboDescription = 232, ObjectSetFiboDescription = 232,
ObjectSetText = 233, ObjectSetText = 233,
ObjectType = 234 ObjectType = 234,
UnlockTicks = 235
} }
} }
+2 -2
View File
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.34.0")] [assembly: AssemblyVersion("1.0.36.0")]
[assembly: AssemblyFileVersion("1.0.34.0")] [assembly: AssemblyFileVersion("1.0.36.0")]
+62 -34
View File
@@ -197,9 +197,11 @@
this.button38 = new System.Windows.Forms.Button(); this.button38 = new System.Windows.Forms.Button();
this.button37 = new System.Windows.Forms.Button(); this.button37 = new System.Windows.Forms.Button();
this.tabPage10 = new System.Windows.Forms.TabPage(); this.tabPage10 = new System.Windows.Forms.TabPage();
this.button68 = new System.Windows.Forms.Button();
this.comboBox11 = new System.Windows.Forms.ComboBox(); this.comboBox11 = new System.Windows.Forms.ComboBox();
this.button4 = new System.Windows.Forms.Button(); this.button4 = new System.Windows.Forms.Button();
this.button68 = new System.Windows.Forms.Button(); this.tabPage11 = new System.Windows.Forms.TabPage();
this.button69 = new System.Windows.Forms.Button();
this.groupBox1.SuspendLayout(); this.groupBox1.SuspendLayout();
this.statusStrip1.SuspendLayout(); this.statusStrip1.SuspendLayout();
this.groupBox2.SuspendLayout(); this.groupBox2.SuspendLayout();
@@ -218,6 +220,7 @@
this.tabPage8.SuspendLayout(); this.tabPage8.SuspendLayout();
this.tabPage9.SuspendLayout(); this.tabPage9.SuspendLayout();
this.tabPage10.SuspendLayout(); this.tabPage10.SuspendLayout();
this.tabPage11.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
// textBoxServerName // textBoxServerName
@@ -240,7 +243,7 @@
this.buttonConnect.Location = new System.Drawing.Point(17, 73); this.buttonConnect.Location = new System.Drawing.Point(17, 73);
this.buttonConnect.Name = "buttonConnect"; this.buttonConnect.Name = "buttonConnect";
this.buttonConnect.Size = new System.Drawing.Size(75, 23); this.buttonConnect.Size = new System.Drawing.Size(75, 23);
this.buttonConnect.TabIndex = 4; this.buttonConnect.TabIndex = 2;
this.buttonConnect.Text = "Connect"; this.buttonConnect.Text = "Connect";
this.buttonConnect.UseVisualStyleBackColor = true; this.buttonConnect.UseVisualStyleBackColor = true;
this.buttonConnect.Click += new System.EventHandler(this.buttonConnect_Click); this.buttonConnect.Click += new System.EventHandler(this.buttonConnect_Click);
@@ -322,7 +325,7 @@
this.checkBox2.Location = new System.Drawing.Point(6, 296); this.checkBox2.Location = new System.Drawing.Point(6, 296);
this.checkBox2.Name = "checkBox2"; this.checkBox2.Name = "checkBox2";
this.checkBox2.Size = new System.Drawing.Size(281, 17); this.checkBox2.Size = new System.Drawing.Size(281, 17);
this.checkBox2.TabIndex = 16; this.checkBox2.TabIndex = 5;
this.checkBox2.Text = "Use selected ExpertHandle (chart) as default executor"; this.checkBox2.Text = "Use selected ExpertHandle (chart) as default executor";
this.checkBox2.UseVisualStyleBackColor = true; this.checkBox2.UseVisualStyleBackColor = true;
this.checkBox2.CheckedChanged += new System.EventHandler(this.checkBox2_CheckedChanged); this.checkBox2.CheckedChanged += new System.EventHandler(this.checkBox2_CheckedChanged);
@@ -343,7 +346,7 @@
this.listViewQuotes.MultiSelect = false; this.listViewQuotes.MultiSelect = false;
this.listViewQuotes.Name = "listViewQuotes"; this.listViewQuotes.Name = "listViewQuotes";
this.listViewQuotes.Size = new System.Drawing.Size(292, 271); this.listViewQuotes.Size = new System.Drawing.Size(292, 271);
this.listViewQuotes.TabIndex = 15; this.listViewQuotes.TabIndex = 4;
this.listViewQuotes.UseCompatibleStateImageBehavior = false; this.listViewQuotes.UseCompatibleStateImageBehavior = false;
this.listViewQuotes.View = System.Windows.Forms.View.Details; this.listViewQuotes.View = System.Windows.Forms.View.Details;
this.listViewQuotes.SelectedIndexChanged += new System.EventHandler(this.listViewQuotes_SelectedIndexChanged); this.listViewQuotes.SelectedIndexChanged += new System.EventHandler(this.listViewQuotes_SelectedIndexChanged);
@@ -400,6 +403,7 @@
this.tabControl1.Controls.Add(this.tabPage8); this.tabControl1.Controls.Add(this.tabPage8);
this.tabControl1.Controls.Add(this.tabPage9); this.tabControl1.Controls.Add(this.tabPage9);
this.tabControl1.Controls.Add(this.tabPage10); this.tabControl1.Controls.Add(this.tabPage10);
this.tabControl1.Controls.Add(this.tabPage11);
this.tabControl1.Location = new System.Drawing.Point(324, 12); this.tabControl1.Location = new System.Drawing.Point(324, 12);
this.tabControl1.Multiline = true; this.tabControl1.Multiline = true;
this.tabControl1.Name = "tabControl1"; this.tabControl1.Name = "tabControl1";
@@ -442,7 +446,7 @@
this.button22.Location = new System.Drawing.Point(216, 293); this.button22.Location = new System.Drawing.Point(216, 293);
this.button22.Name = "button22"; this.button22.Name = "button22";
this.button22.Size = new System.Drawing.Size(75, 23); this.button22.Size = new System.Drawing.Size(75, 23);
this.button22.TabIndex = 19; this.button22.TabIndex = 31;
this.button22.Text = "OrderModify"; this.button22.Text = "OrderModify";
this.button22.UseVisualStyleBackColor = true; this.button22.UseVisualStyleBackColor = true;
this.button22.Click += new System.EventHandler(this.button22_Click); this.button22.Click += new System.EventHandler(this.button22_Click);
@@ -452,7 +456,7 @@
this.button21.Location = new System.Drawing.Point(216, 264); this.button21.Location = new System.Drawing.Point(216, 264);
this.button21.Name = "button21"; this.button21.Name = "button21";
this.button21.Size = new System.Drawing.Size(75, 23); this.button21.Size = new System.Drawing.Size(75, 23);
this.button21.TabIndex = 18; this.button21.TabIndex = 30;
this.button21.Text = "OrderDelete"; this.button21.Text = "OrderDelete";
this.button21.UseVisualStyleBackColor = true; this.button21.UseVisualStyleBackColor = true;
this.button21.Click += new System.EventHandler(this.button21_Click); this.button21.Click += new System.EventHandler(this.button21_Click);
@@ -471,7 +475,7 @@
this.textBoxOppositeTicket.Location = new System.Drawing.Point(303, 239); this.textBoxOppositeTicket.Location = new System.Drawing.Point(303, 239);
this.textBoxOppositeTicket.Name = "textBoxOppositeTicket"; this.textBoxOppositeTicket.Name = "textBoxOppositeTicket";
this.textBoxOppositeTicket.Size = new System.Drawing.Size(100, 20); this.textBoxOppositeTicket.Size = new System.Drawing.Size(100, 20);
this.textBoxOppositeTicket.TabIndex = 16; this.textBoxOppositeTicket.TabIndex = 28;
this.textBoxOppositeTicket.Text = "0"; this.textBoxOppositeTicket.Text = "0";
// //
// button15 // button15
@@ -479,7 +483,7 @@
this.button15.Location = new System.Drawing.Point(410, 237); this.button15.Location = new System.Drawing.Point(410, 237);
this.button15.Name = "button15"; this.button15.Name = "button15";
this.button15.Size = new System.Drawing.Size(92, 23); this.button15.Size = new System.Drawing.Size(92, 23);
this.button15.TabIndex = 15; this.button15.TabIndex = 29;
this.button15.Text = "OrderCloseBy"; this.button15.Text = "OrderCloseBy";
this.button15.UseVisualStyleBackColor = true; this.button15.UseVisualStyleBackColor = true;
this.button15.Click += new System.EventHandler(this.button15_Click); this.button15.Click += new System.EventHandler(this.button15_Click);
@@ -490,7 +494,7 @@
this.checkBox1.Location = new System.Drawing.Point(297, 208); this.checkBox1.Location = new System.Drawing.Point(297, 208);
this.checkBox1.Name = "checkBox1"; this.checkBox1.Name = "checkBox1";
this.checkBox1.Size = new System.Drawing.Size(205, 17); this.checkBox1.Size = new System.Drawing.Size(205, 17);
this.checkBox1.TabIndex = 14; this.checkBox1.TabIndex = 27;
this.checkBox1.Text = "Close order by current price on market"; this.checkBox1.Text = "Close order by current price on market";
this.checkBox1.UseVisualStyleBackColor = true; this.checkBox1.UseVisualStyleBackColor = true;
// //
@@ -499,7 +503,7 @@
this.button20.Location = new System.Drawing.Point(216, 202); this.button20.Location = new System.Drawing.Point(216, 202);
this.button20.Name = "button20"; this.button20.Name = "button20";
this.button20.Size = new System.Drawing.Size(75, 23); this.button20.Size = new System.Drawing.Size(75, 23);
this.button20.TabIndex = 13; this.button20.TabIndex = 26;
this.button20.Text = "OrderClose"; this.button20.Text = "OrderClose";
this.button20.UseVisualStyleBackColor = true; this.button20.UseVisualStyleBackColor = true;
this.button20.Click += new System.EventHandler(this.button20_Click); this.button20.Click += new System.EventHandler(this.button20_Click);
@@ -509,7 +513,7 @@
this.button17.Location = new System.Drawing.Point(558, 158); this.button17.Location = new System.Drawing.Point(558, 158);
this.button17.Name = "button17"; this.button17.Name = "button17";
this.button17.Size = new System.Drawing.Size(75, 23); this.button17.Size = new System.Drawing.Size(75, 23);
this.button17.TabIndex = 12; this.button17.TabIndex = 25;
this.button17.Text = "GetOrders"; this.button17.Text = "GetOrders";
this.button17.UseVisualStyleBackColor = true; this.button17.UseVisualStyleBackColor = true;
this.button17.Click += new System.EventHandler(this.button17_Click); this.button17.Click += new System.EventHandler(this.button17_Click);
@@ -524,7 +528,7 @@
this.comboBox2.Location = new System.Drawing.Point(341, 158); this.comboBox2.Location = new System.Drawing.Point(341, 158);
this.comboBox2.Name = "comboBox2"; this.comboBox2.Name = "comboBox2";
this.comboBox2.Size = new System.Drawing.Size(114, 21); this.comboBox2.Size = new System.Drawing.Size(114, 21);
this.comboBox2.TabIndex = 11; this.comboBox2.TabIndex = 23;
// //
// comboBox1 // comboBox1
// //
@@ -536,14 +540,14 @@
this.comboBox1.Location = new System.Drawing.Point(216, 158); this.comboBox1.Location = new System.Drawing.Point(216, 158);
this.comboBox1.Name = "comboBox1"; this.comboBox1.Name = "comboBox1";
this.comboBox1.Size = new System.Drawing.Size(119, 21); this.comboBox1.Size = new System.Drawing.Size(119, 21);
this.comboBox1.TabIndex = 10; this.comboBox1.TabIndex = 22;
// //
// button16 // button16
// //
this.button16.Location = new System.Drawing.Point(461, 158); this.button16.Location = new System.Drawing.Point(461, 158);
this.button16.Name = "button16"; this.button16.Name = "button16";
this.button16.Size = new System.Drawing.Size(75, 23); this.button16.Size = new System.Drawing.Size(75, 23);
this.button16.TabIndex = 9; this.button16.TabIndex = 24;
this.button16.Text = "GetOrder"; this.button16.Text = "GetOrder";
this.button16.UseVisualStyleBackColor = true; this.button16.UseVisualStyleBackColor = true;
this.button16.Click += new System.EventHandler(this.button16_Click); this.button16.Click += new System.EventHandler(this.button16_Click);
@@ -562,7 +566,7 @@
this.textBoxIndexTicket.Location = new System.Drawing.Point(290, 132); this.textBoxIndexTicket.Location = new System.Drawing.Point(290, 132);
this.textBoxIndexTicket.Name = "textBoxIndexTicket"; this.textBoxIndexTicket.Name = "textBoxIndexTicket";
this.textBoxIndexTicket.Size = new System.Drawing.Size(109, 20); this.textBoxIndexTicket.Size = new System.Drawing.Size(109, 20);
this.textBoxIndexTicket.TabIndex = 7; this.textBoxIndexTicket.TabIndex = 21;
this.textBoxIndexTicket.Text = "0"; this.textBoxIndexTicket.Text = "0";
// //
// comboBoxSelectedCommand // comboBoxSelectedCommand
@@ -596,7 +600,7 @@
this.comboBoxSelectedCommand.Location = new System.Drawing.Point(213, 344); this.comboBoxSelectedCommand.Location = new System.Drawing.Point(213, 344);
this.comboBoxSelectedCommand.Name = "comboBoxSelectedCommand"; this.comboBoxSelectedCommand.Name = "comboBoxSelectedCommand";
this.comboBoxSelectedCommand.Size = new System.Drawing.Size(121, 21); this.comboBoxSelectedCommand.Size = new System.Drawing.Size(121, 21);
this.comboBoxSelectedCommand.TabIndex = 6; this.comboBoxSelectedCommand.TabIndex = 32;
// //
// label15 // label15
// //
@@ -624,14 +628,14 @@
this.listBoxClosedOrders.Location = new System.Drawing.Point(213, 85); this.listBoxClosedOrders.Location = new System.Drawing.Point(213, 85);
this.listBoxClosedOrders.Name = "listBoxClosedOrders"; this.listBoxClosedOrders.Name = "listBoxClosedOrders";
this.listBoxClosedOrders.Size = new System.Drawing.Size(419, 43); this.listBoxClosedOrders.Size = new System.Drawing.Size(419, 43);
this.listBoxClosedOrders.TabIndex = 5; this.listBoxClosedOrders.TabIndex = 20;
// //
// button2 // button2
// //
this.button2.Location = new System.Drawing.Point(356, 342); this.button2.Location = new System.Drawing.Point(356, 342);
this.button2.Name = "button2"; this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(87, 23); this.button2.Size = new System.Drawing.Size(87, 23);
this.button2.TabIndex = 2; this.button2.TabIndex = 33;
this.button2.Text = "Execute"; this.button2.Text = "Execute";
this.button2.UseVisualStyleBackColor = true; this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.button2_Click); this.button2.Click += new System.EventHandler(this.button2_Click);
@@ -675,7 +679,7 @@
this.button19.Location = new System.Drawing.Point(87, 336); this.button19.Location = new System.Drawing.Point(87, 336);
this.button19.Name = "button19"; this.button19.Name = "button19";
this.button19.Size = new System.Drawing.Size(75, 23); this.button19.Size = new System.Drawing.Size(75, 23);
this.button19.TabIndex = 15; this.button19.TabIndex = 18;
this.button19.Text = "Sell"; this.button19.Text = "Sell";
this.button19.UseVisualStyleBackColor = true; this.button19.UseVisualStyleBackColor = true;
this.button19.Click += new System.EventHandler(this.button19_Click); this.button19.Click += new System.EventHandler(this.button19_Click);
@@ -685,7 +689,7 @@
this.button18.Location = new System.Drawing.Point(6, 336); this.button18.Location = new System.Drawing.Point(6, 336);
this.button18.Name = "button18"; this.button18.Name = "button18";
this.button18.Size = new System.Drawing.Size(75, 23); this.button18.Size = new System.Drawing.Size(75, 23);
this.button18.TabIndex = 14; this.button18.TabIndex = 17;
this.button18.Text = "Buy"; this.button18.Text = "Buy";
this.button18.UseVisualStyleBackColor = true; this.button18.UseVisualStyleBackColor = true;
this.button18.Click += new System.EventHandler(this.button18_Click); this.button18.Click += new System.EventHandler(this.button18_Click);
@@ -700,28 +704,28 @@
this.comboBoxOrderColor.Location = new System.Drawing.Point(69, 281); this.comboBoxOrderColor.Location = new System.Drawing.Point(69, 281);
this.comboBoxOrderColor.Name = "comboBoxOrderColor"; this.comboBoxOrderColor.Name = "comboBoxOrderColor";
this.comboBoxOrderColor.Size = new System.Drawing.Size(121, 21); this.comboBoxOrderColor.Size = new System.Drawing.Size(121, 21);
this.comboBoxOrderColor.TabIndex = 13; this.comboBoxOrderColor.TabIndex = 15;
// //
// textBox2 // textBox2
// //
this.textBox2.Location = new System.Drawing.Point(70, 255); this.textBox2.Location = new System.Drawing.Point(70, 255);
this.textBox2.Name = "textBox2"; this.textBox2.Name = "textBox2";
this.textBox2.Size = new System.Drawing.Size(120, 20); this.textBox2.Size = new System.Drawing.Size(120, 20);
this.textBox2.TabIndex = 11; this.textBox2.TabIndex = 14;
// //
// textBoxOrderMagic // textBoxOrderMagic
// //
this.textBoxOrderMagic.Location = new System.Drawing.Point(70, 229); this.textBoxOrderMagic.Location = new System.Drawing.Point(70, 229);
this.textBoxOrderMagic.Name = "textBoxOrderMagic"; this.textBoxOrderMagic.Name = "textBoxOrderMagic";
this.textBoxOrderMagic.Size = new System.Drawing.Size(120, 20); this.textBoxOrderMagic.Size = new System.Drawing.Size(120, 20);
this.textBoxOrderMagic.TabIndex = 11; this.textBoxOrderMagic.TabIndex = 13;
// //
// textBoxOrderComment // textBoxOrderComment
// //
this.textBoxOrderComment.Location = new System.Drawing.Point(70, 203); this.textBoxOrderComment.Location = new System.Drawing.Point(70, 203);
this.textBoxOrderComment.Name = "textBoxOrderComment"; this.textBoxOrderComment.Name = "textBoxOrderComment";
this.textBoxOrderComment.Size = new System.Drawing.Size(120, 20); this.textBoxOrderComment.Size = new System.Drawing.Size(120, 20);
this.textBoxOrderComment.TabIndex = 11; this.textBoxOrderComment.TabIndex = 12;
// //
// textBoxOrderProffit // textBoxOrderProffit
// //
@@ -878,7 +882,7 @@
this.button1.Location = new System.Drawing.Point(120, 307); this.button1.Location = new System.Drawing.Point(120, 307);
this.button1.Name = "button1"; this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 23); this.button1.Size = new System.Drawing.Size(75, 23);
this.button1.TabIndex = 12; this.button1.TabIndex = 16;
this.button1.Text = "Send"; this.button1.Text = "Send";
this.button1.UseVisualStyleBackColor = true; this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click); this.button1.Click += new System.EventHandler(this.button1_Click);
@@ -909,7 +913,7 @@
this.listBoxSendedOrders.Name = "listBoxSendedOrders"; this.listBoxSendedOrders.Name = "listBoxSendedOrders";
this.listBoxSendedOrders.SelectionMode = System.Windows.Forms.SelectionMode.MultiSimple; this.listBoxSendedOrders.SelectionMode = System.Windows.Forms.SelectionMode.MultiSimple;
this.listBoxSendedOrders.Size = new System.Drawing.Size(419, 43); this.listBoxSendedOrders.Size = new System.Drawing.Size(419, 43);
this.listBoxSendedOrders.TabIndex = 1; this.listBoxSendedOrders.TabIndex = 19;
// //
// tabPage1 // tabPage1
// //
@@ -2008,6 +2012,16 @@
this.tabPage10.Text = "Object Functions"; this.tabPage10.Text = "Object Functions";
this.tabPage10.UseVisualStyleBackColor = true; this.tabPage10.UseVisualStyleBackColor = true;
// //
// button68
//
this.button68.Location = new System.Drawing.Point(6, 39);
this.button68.Name = "button68";
this.button68.Size = new System.Drawing.Size(75, 23);
this.button68.TabIndex = 2;
this.button68.Text = "ObjectName";
this.button68.UseVisualStyleBackColor = true;
this.button68.Click += new System.EventHandler(this.button68_Click);
//
// comboBox11 // comboBox11
// //
this.comboBox11.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.comboBox11.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
@@ -2027,15 +2041,26 @@
this.button4.UseVisualStyleBackColor = true; this.button4.UseVisualStyleBackColor = true;
this.button4.Click += new System.EventHandler(this.button4_Click); this.button4.Click += new System.EventHandler(this.button4_Click);
// //
// button68 // tabPage11
// //
this.button68.Location = new System.Drawing.Point(6, 39); this.tabPage11.Controls.Add(this.button69);
this.button68.Name = "button68"; this.tabPage11.Location = new System.Drawing.Point(4, 40);
this.button68.Size = new System.Drawing.Size(75, 23); this.tabPage11.Name = "tabPage11";
this.button68.TabIndex = 2; this.tabPage11.Padding = new System.Windows.Forms.Padding(3);
this.button68.Text = "ObjectName"; this.tabPage11.Size = new System.Drawing.Size(638, 383);
this.button68.UseVisualStyleBackColor = true; this.tabPage11.TabIndex = 11;
this.button68.Click += new System.EventHandler(this.button68_Click); this.tabPage11.Text = "Backtesting";
this.tabPage11.UseVisualStyleBackColor = true;
//
// button69
//
this.button69.Location = new System.Drawing.Point(6, 6);
this.button69.Name = "button69";
this.button69.Size = new System.Drawing.Size(75, 23);
this.button69.TabIndex = 4;
this.button69.Text = "UnlockTicks";
this.button69.UseVisualStyleBackColor = true;
this.button69.Click += new System.EventHandler(this.button69_Click);
// //
// Form1 // Form1
// //
@@ -2081,6 +2106,7 @@
this.tabPage9.ResumeLayout(false); this.tabPage9.ResumeLayout(false);
this.tabPage9.PerformLayout(); this.tabPage9.PerformLayout();
this.tabPage10.ResumeLayout(false); this.tabPage10.ResumeLayout(false);
this.tabPage11.ResumeLayout(false);
this.ResumeLayout(false); this.ResumeLayout(false);
this.PerformLayout(); this.PerformLayout();
@@ -2259,6 +2285,8 @@
private System.Windows.Forms.ComboBox comboBox11; private System.Windows.Forms.ComboBox comboBox11;
private System.Windows.Forms.TextBox textBoxChartId; private System.Windows.Forms.TextBox textBoxChartId;
private System.Windows.Forms.Button button68; private System.Windows.Forms.Button button68;
private System.Windows.Forms.TabPage tabPage11;
private System.Windows.Forms.Button button69;
} }
} }
+42 -20
View File
@@ -673,6 +673,8 @@ namespace TestApiClientUI
//OrderSend //OrderSend
private async void button1_Click(object sender, EventArgs e) private async void button1_Click(object sender, EventArgs e)
{ {
var ticket = -1;
var symbol = textBoxOrderSymbol.Text; var symbol = textBoxOrderSymbol.Text;
var cmd = (TradeOperation) comboBoxOrderCommand.SelectedIndex; var cmd = (TradeOperation) comboBoxOrderCommand.SelectedIndex;
@@ -693,28 +695,43 @@ namespace TestApiClientUI
var comment = textBoxOrderComment.Text; var comment = textBoxOrderComment.Text;
int magic; if (string.IsNullOrEmpty(comment))
int.TryParse(textBoxOrderMagic.Text, out magic);
var expiration = DateTime.Now;
Color arrowColor;
switch (comboBoxOrderColor.SelectedIndex)
{ {
case 0: ticket = await Execute(() => _apiClient.OrderSend(symbol, cmd, volume, price, slippage, stoploss, takeprofit));
arrowColor = Color.Green; }
break; else
case 1: {
arrowColor = Color.Blue; int magic;
break; if (!int.TryParse(textBoxOrderMagic.Text, out magic))
case 2: {
arrowColor = Color.Red; ticket = await Execute(() => _apiClient.OrderSend(symbol, cmd, volume, price, slippage, stoploss, takeprofit, comment));
break; }
default: else
return; {
if (comboBoxOrderColor.SelectedIndex < 0 || comboBoxOrderColor.SelectedIndex > 2)
{
ticket = await Execute(() => _apiClient.OrderSend(symbol, cmd, volume, price, slippage, stoploss, takeprofit, comment, magic));
}
else
{
var expiration = DateTime.Now.AddDays(1);
Color arrowColor = Color.White;
switch (comboBoxOrderColor.SelectedIndex)
{
case 0:
arrowColor = Color.Green;
break;
case 1:
arrowColor = Color.Blue;
break;
case 2:
arrowColor = Color.Red;
break;
}
ticket = await Execute(() => _apiClient.OrderSend(symbol, cmd, volume, price, slippage, stoploss, takeprofit, comment, magic, expiration, arrowColor));
}
}
} }
var ticket = await Execute(() => _apiClient.OrderSend(symbol, cmd, volume, price, slippage, stoploss, takeprofit, comment, magic, expiration, arrowColor));
PrintLog($"Sended order result: ticket = {ticket}"); PrintLog($"Sended order result: ticket = {ticket}");
} }
@@ -1402,5 +1419,10 @@ namespace TestApiClientUI
var result = await Execute(() => _apiClient.ObjectName(chartId, objectIndex)); var result = await Execute(() => _apiClient.ObjectName(chartId, objectIndex));
PrintLog($"ObjectName result: {result}"); PrintLog($"ObjectName result: {result}");
} }
private void button69_Click(object sender, EventArgs e)
{
_apiClient.UnlockTicks();
}
} }
} }
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.