Countdown for next Bar
22 Oct 2012, 15:56
Hi,
Is it possible to code the countdown for the next Bar? If so how?
Thanks
Replies
PanagiotisCharalampous
22 Feb 2019, 10:45
Hi lec0456.
This is not available via the API but I think you can easily code this.
Best Regards,
Panagiotis
@PanagiotisCharalampous
alexk
22 Feb 2019, 17:42
I did last night!! it opens a form that displays the countdown in a large font.
using System;
using cAlgo.API;
using System.Threading;
using System.Windows.Forms;
namespace cAlgo.Robots
{
[Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.FullAccess)]
public class myCandleCountDown : Robot
{
[Parameter("Alert On", DefaultValue = true)]
public bool paramAlertOn { get; set; }
private Thread _thread;
private frmCandleCountdown _counter;
protected override void OnStart()
{
Timer.Start(1);
_counter = new frmCandleCountdown();
//_thread = new Thread(() =>{ _counter.ShowDialog(); });
_thread = new Thread(() => { Application.Run(_counter); });
_thread.SetApartmentState(ApartmentState.STA);
_thread.Start();
}
protected override void OnTimer()
{
int cdMinutes = 14 - Time.Minute % 15;
int cdSeconds = 59 - Time.Second;
_thread = new Thread(() => _counter.UpdateCounter(cdMinutes.ToString("00")+":"+cdSeconds.ToString("00")));
_thread.SetApartmentState(ApartmentState.STA);
_thread.Start();
if(cdMinutes==0 && cdSeconds==0 && paramAlertOn)
Notifications.PlaySound(@"C:\Users\user\Documents\cAlgo\Sources\Robots\CountdownTimer.wav");
}
}
}
I added a simple form with a label and one function.
public void UpdateCounter(string _text)
{
lblCounter.Text = _text;
}
@alexk

admin
23 Oct 2012, 09:54
When we introduce multitime frames it will be possible to code the countdown for the next Bar.
Multitime frames are comming soon, so stay tuned!
@admin