fxpathway
fxpathway 06 May 2013, 12:18
Hello, You can use the Timers Class and do the following: using System.Timers; //... private readonly Timer _timer = new Timer(); protected override void OnStart() { _timer.Elapsed += OnTimedEvent; // OnTimedEvent is called at each timer tick _timer.Interval = (Interval) * 3600 * 1000; // Timer will tick every Interval (milliseconds) _timer.Enabled = true; // Enable the timer _timer.Start(); // Start the timer } private void OnTimedEvent(object sender, ElapsedEventArgs e) { // Your logic here }
Hello,
You can use the Timers Class and do the following:
using System.Timers; //... private readonly Timer _timer = new Timer(); protected override void OnStart() { _timer.Elapsed += OnTimedEvent; // OnTimedEvent is called at each timer tick _timer.Interval = (Interval) * 3600 * 1000; // Timer will tick every Interval (milliseconds) _timer.Enabled = true; // Enable the timer _timer.Start(); // Start the timer } private void OnTimedEvent(object sender, ElapsedEventArgs e) { // Your logic here }
Hallo Support,
I modified my code to use the timer class as above, and it crashed when I did the backtest.
Any reason why it caused the crash?
Sincerely,
fxpathway
06 May 2013, 12:18
RE:
Hallo Support,
I modified my code to use the timer class as above, and it crashed when I did the backtest.
Any reason why it caused the crash?
Sincerely,
@fxpathway