protected override void OnStateChange() { if (State == State.SetDefaults) { Description = @"Enter the description for your new custom Add on here."; Name = "SureshTradingSystemAddon"; Account.AccountStatusUpdate += Account_AccountStatusUpdate; // Find our Sim101 account lock (Account.All) { fxcmaccount = Account.All.FirstOrDefault(a => a.Name == "xxxxxxxx" );//"Sim101");// change it to // Subscribe to account item updates if (fxcmaccount != null) { // account.AccountItemUpdate += OnAccountItemUpdate; fxcmaccount.ExecutionUpdate += Account_ExecutionUpdate; } simaccount = Account.All.FirstOrDefault(a => a.Name == "Sim101" );//"Sim101") // Subscribe to account item updates if (simaccount != null) { // account.AccountItemUpdate += OnAccountItemUpdate; simaccount.ExecutionUpdate += Account_ExecutionUpdate; } }
private void Account_ExecutionUpdate(object sender, ExecutionEventArgs e) { Print(String.Format("Execution triggered for Order {0}", e.ToString())); NinjaTrader.Core.Globals.SendMail( "[email protected]", "@boards.trello.com", "trade ", e.ToString(),null) ; NinjaTrader.NinjaScript.Alert.AlertCallback(e.Execution.Instrument, this, DateTime.Now.ToString(), NinjaTrader.Core.Globals.Now, Priority.High, e.ToString(), NinjaTrader.Core.Globals.InstallDir+@"\sounds\Alert1.wav", new SolidColorBrush(Colors.Blue), new SolidColorBrush(Colors.White), 0); //PostMessage(e.ToString(),true,e.Execution.Instrument); }
Email - Message sent successfully Email - Message sent successfully Email - Message sent successfully Execution triggered for Order executionId='a5f198e7e99e45258515e12041678bad' account='Sim101' instrument='AUDUSD' exchange=Default price=0.75562 quantity=1,000 marketPosition=Short operation=Add orderID='e817373212b14fd386c0592b4f54a632' time='1/19/2017 3:12:43 PM' statementDate='2017-01-19' Execution triggered for Order executionId='a5f198e7e99e45258515e12041678bad' account='Sim101' instrument='AUDUSD' exchange=Default price=0.75562 quantity=1,000 marketPosition=Short operation=Add orderID='e817373212b14fd386c0592b4f54a632' time='1/19/2017 3:12:43 PM' statementDate='2017-01-19' Execution triggered for Order executionId='a5f198e7e99e45258515e12041678bad' account='Sim101' instrument='AUDUSD' exchange=Default price=0.75562 quantity=1,000 marketPosition=Short operation=Add orderID='e817373212b14fd386c0592b4f54a632' time='1/19/2017 3:12:43 PM' statementDate='2017-01-19'
Comment