mirror of
https://github.com/vdemydiuk/mtapi.git
synced 2026-07-28 02:57:56 +00:00
Fixed issue #5: Color representation. MQL uses different color representation than C# System.Drawing.Color (Thanks Tr4Dr).
This commit is contained in:
@@ -10,12 +10,12 @@ namespace MtApi
|
||||
{
|
||||
public static Color ConvertFromMtColor(int color)
|
||||
{
|
||||
return Color.FromArgb(color);
|
||||
return Color.FromArgb((byte)(color), (byte)(color >> 8), (byte)(color >> 16));
|
||||
}
|
||||
|
||||
public static int ConvertToMtColor(Color color)
|
||||
{
|
||||
return color == Color.Empty ? 0xffffff : (color.ToArgb() & 0xffffff);
|
||||
return color == Color.Empty ? 0xffffff : (Color.FromArgb(color.B, color.G, color.R).ToArgb() & 0xffffff);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -980,6 +980,7 @@ namespace TestApiClientUI
|
||||
AddToLog(string.Format("Delete order result: {0}, ticket = {1}", deleted, ticket));
|
||||
}
|
||||
|
||||
//OrderModify
|
||||
private async void button22_Click(object sender, EventArgs e)
|
||||
{
|
||||
var ticket = int.Parse(textBoxIndexTicket.Text);
|
||||
@@ -995,12 +996,26 @@ namespace TestApiClientUI
|
||||
|
||||
var expiration = DateTime.MinValue;
|
||||
|
||||
var modified = await Execute(() => _apiClient.OrderModify(ticket, price, stoploss, takeprofit, expiration));
|
||||
Color color = new Color();
|
||||
switch (comboBoxOrderColor.SelectedIndex)
|
||||
{
|
||||
case 0:
|
||||
color = Color.Green;
|
||||
break;
|
||||
case 1:
|
||||
color = Color.Blue;
|
||||
break;
|
||||
case 2:
|
||||
color = Color.Red;
|
||||
break;
|
||||
}
|
||||
|
||||
var modified = await Execute(() => _apiClient.OrderModify(ticket, price, stoploss, takeprofit, expiration, color));
|
||||
|
||||
AddToLog(string.Format("Modify order result: {0}, ticket = {1}", modified, ticket));
|
||||
}
|
||||
|
||||
//iCustom
|
||||
//iCustom (ZigZag)
|
||||
private async void iCustomBtn_Click(object sender, EventArgs e)
|
||||
{
|
||||
string symbol = "EURUSD";
|
||||
@@ -1013,6 +1028,7 @@ namespace TestApiClientUI
|
||||
AddToLog(string.Format("ICustom result: {0}", retVal));
|
||||
}
|
||||
|
||||
//iCustom (Parabolic)
|
||||
private async void button23_Click(object sender, EventArgs e)
|
||||
{
|
||||
string symbol = "EURUSD";
|
||||
|
||||
Reference in New Issue
Block a user