retesere20

alerts example 2 NT8 c#

Jul 26th, 2019
116
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. in top:
  2. private MyMethodsLibrary_TT.mymethods pp = new MyMethodsLibrary_TT.mymethods();
  3. private MyMethodsLibrary_TT.Alerts_Price alerts = new MyMethodsLibrary_TT.Alerts_Price(1, 2);
  4.  
  5.  
  6. [Display(Name = "Enable Alert 1", Order = 10, GroupName="Parameters - Alerts")]
  7. public bool enableAlert_1
  8. { get { return alerts.EnabledAlerts[1][1]; } set { alerts.EnabledAlerts[1][1] = value; } }
  9.  
  10. [Display(Name="Ticks prior (Alert 1)", Order = 20, GroupName="Parameters - Alerts")]
  11. public int alert_ticks_prior_1
  12. { get { return alerts.TicksBeforeAlert[1][1]; } set { alerts.TicksBeforeAlert[1][1] = value; } }
  13.  
  14. [Display(Name="sound file (Alert 1)", Order = 30, GroupName="Parameters - Alerts")]
  15. public string alert_sound_file_1
  16. { get { return alerts.SoundFiles[1][1]; } set { alerts.SoundFiles[1][1] = value; } }
  17.  
  18.  
  19. [Display(Name = "Enable Alert 2", Order = 10, GroupName="Parameters - Alerts")]
  20. public bool enableAlert_2
  21. { get { return alerts.EnabledAlerts[1][2]; } set { alerts.EnabledAlerts[1][2] = value; } }
  22.  
  23. [Display(Name="Ticks prior (Alert 2)", Order = 20, GroupName="Parameters - Alerts")]
  24. public int alert_ticks_prior_2
  25. { get { return alerts.TicksBeforeAlert[1][2]; } set { alerts.TicksBeforeAlert[1][2] = value; } }
  26.  
  27. [Display(Name="sound file (Alert 2)", Order = 30, GroupName="Parameters - Alerts")]
  28. public string alert_sound_file_2
  29. { get { return alerts.SoundFiles[1][2]; } set { alerts.SoundFiles[1][2] = value; } }
  30.  
  31.  
  32.  
  33. in "State.SetDefaults:
  34.  
  35. alerts.EnabledAlerts[1][1] = true;
  36. alerts.MinutesBeforeAlert[1][1] = 30;
  37. alerts.SoundFiles[1][1] = NinjaTrader.Core.Globals.UserDataDir+@"\templates\MyResources\Alert1.wav";
  38.  
  39. alerts.EnabledAlerts[1][2] = true;
  40. alerts.MinutesBeforeAlert[1][2] = 5;
  41. alerts.SoundFiles[1][2] = NinjaTrader.Core.Globals.UserDataDir+@"\templates\MyResources\Alert2.wav";
  42.  
  43. in OnBarUpdate:
  44.  
  45. CheckAlerts(this, Close, central_price, soundPath, "close is near!");
RAW Paste Data