TriggerCustomEvent numpad9 and 6 (line 55 to 72)

mail@pastecode.io avatar
unknown
csharp
2 years ago
1.6 kB
2
Indexable
Never
		protected void ChartPanel_KeyDown(object sender, KeyEventArgs e)
        {
			TriggerCustomEvent(o =>
			{
				Order buyMktOrder = null;

				if (Keyboard.IsKeyDown(Key.NumPad7))
				{
					buyMktOrder  = account.CreateOrder(
									Instrument, 
									OrderAction.Buy, 
									OrderType.Market, 
									OrderEntry.Manual, 
									TimeInForce.Day, 
									1, 
									0, 
									0, 
									"", 
									"buyMktOrder"+DateTime.Now.ToString(), 
									DateTime.MaxValue, 
									null);
				}
				
				account.Submit(new[] { buyMktOrder });
			}, null);
			e.Handled = true;
			
			
			TriggerCustomEvent(p =>
			{
				Order sellMktOrder = null;
				
				if (Keyboard.IsKeyDown(Key.NumPad8))
				{
					sellMktOrder = account.CreateOrder(
									Instrument, 
									OrderAction.Sell, 
									OrderType.Market, 
									OrderEntry.Manual, 
									TimeInForce.Day, 
									1, 
									0, 
									0, 
									"", 
									"sellMktOrder"+DateTime.Now.ToString(), 
									DateTime.MaxValue, 
									null);
				}
				
				account.Submit(new[] { sellMktOrder });
			}, null);
			e.Handled = true;
			
			
			TriggerCustomEvent(q =>
			{
				if (Keyboard.IsKeyDown(Key.NumPad9))
				{
					HandleStopLossPlus("keyPress9", 0);
				}
			}, null);
			e.Handled = true;
			
	
			TriggerCustomEvent(r =>
			{
				if (Keyboard.IsKeyDown(Key.NumPad6))
				{
					HandleBreakEvenPlus("keyPress6");
				}
			}, null);
			e.Handled = true;
			
			
        }