-
Notifications
You must be signed in to change notification settings - Fork 1
/
Form2_Roll.cs
149 lines (126 loc) · 4.17 KB
/
Form2_Roll.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
using System;
using System.Data;
using System.Drawing;
using System.Windows.Forms;
using LOG;
namespace X_Platform2
{
/// <summary>
///
/// </summary>
public partial class Form2_Roll : Form
{
/// <summary>
///
/// </summary>
public Form2_Roll()
{
InitializeComponent();
}
/// <summary>
///
/// </summary>
public decimal inc = 0;
/// <summary>
///
/// </summary>
public int places = 0;
/// <summary>
///
/// </summary>
public int x = 0;
/// <summary>
///
/// </summary>
public int y = 0;
/// <summary>
///
/// </summary>
public DataSet mdrUpdate = null;
/// <summary>
///
/// </summary>
public Form1 mainForm = null;
LogFiles log = null;
private void Form2_Roll_Load(object sender, EventArgs e)
{
try
{
this.DesktopLocation = new Point(x, y);
this.numericUpDown1.Increment = inc;
this.numericUpDown1.DecimalPlaces = places;
}
catch (Exception ex)
{ MessageBox.Show(ex.ToString()); }
log = new LogFiles("ROLL");
}
private void button1_Click(object sender, EventArgs e)
{
if (radioButton1.Checked == false && radioButton2.Checked == false)
{
MessageBox.Show("You must choose one of the contract specifications!");
return;
}
else
{
DataRow rollUpdate = mdrUpdate.Tables[0].Rows[0];
for (int i = 0; i < rollUpdate.ItemArray.GetUpperBound(0) +1; i++)
{
if (rollUpdate.ItemArray[i] != null)
{
log.WriteLog(rollUpdate.ItemArray[i].ToString());
}
else
log.WriteLog("NULL VALUE");
}
decimal stp = Convert.ToDecimal(rollUpdate[7]);
//decimal bv = Convert.ToDecimal(rollUpdate[8]);
log.WriteLog(stp.ToString());
if (radioButton1.Checked == true)
{
stp -= this.numericUpDown1.Value;
if (mainForm.longShort == "S")
{ mainForm.buystop = stp; }
else
{ mainForm.sellstop = stp; }
mainForm.nudOpen.Value -= this.numericUpDown1.Value;
}
if (radioButton2.Checked == true)
{
stp += this.numericUpDown1.Value;
if (mainForm.longShort == "S")
{ mainForm.buystop = stp; }
else
{ mainForm.sellstop = stp; }
mainForm.nudOpen.Value += this.numericUpDown1.Value; ;
}
//if (mainForm.longShort == "S")
//{ bv += this.numericUpDown1.Value; }
//else
//{ bv -= this.numericUpDown1.Value; }
log.WriteLog(stp.ToString());
rollUpdate.BeginEdit();
rollUpdate[7] = stp;
//rollUpdate[8] = bv;
rollUpdate.AcceptChanges();
mdrUpdate.WriteXml("CONTRACT.XML");
mainForm._saveCurrentDaySettingINI();
//mainForm.bV = bv;
}
//mainForm._LoadMDR();
// mainForm._calcOrders();
// mainForm._queueCurrentOrder();
this.Hide();
// if (!mainForm.isExchangeOpenUsed)
MessageBox.Show("Manually Verify Order Price!");
}
private void Form2_Roll_FormClosed(object sender, FormClosedEventArgs e)
{
if (e.CloseReason == CloseReason.UserClosing)
{
MessageBox.Show("Spread data not entered.\r\nContract and order info do not match\r\nApplication will exit");
Application.Exit();
}
}
}
}