Please help get timer sync value of this code
Created at 03 Aug 2022, 09:05
Please help get timer sync value of this code
03 Aug 2022, 09:05
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using cAlgo.API;
using cAlgo.API.Collections;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;
namespace cAlgo.Robots
{
[Robot(AccessRights = AccessRights.None)]
public class NewcBot2 : Robot
{
private int _tickCounter;
protected override void OnStart()
{
// To learn more about cTrader Automate visit our Help Center:
// https://help.ctrader.com/ctrader-automate
Timer.TimerTick += Timer_TimerTick;
Timer.Start(60);
}
private void Timer_TimerTick()
{
_tickCounter = 0;
}
protected override void OnTick()
{
// Handle price updates here
_tickCounter++;
Print(_tickCounter);
}
protected override void OnStop()
{
// Handle cBot stop here
}
}
}
In this code counting tick is ok. But how do i get timer sync value of second. I need monitor remaing time. Please help.
Replies
MongolTrader
03 Aug 2022, 10:58
RE:
PanagiotisCharalampous said:
Hi MongolTrader,
You can do the following
- Set the timer to a 1 second interval
- Add a counter for seconds and count on each interval
- Reset the counters every 60 seconds.
Best Regards,
Panagiotis
Please code me im not sure write this code.
@MongolTrader
PanagiotisCharalampous
03 Aug 2022, 10:55
Hi MongolTrader,
You can do the following
Best Regards,
Panagiotis
Join us on Telegram and Facebook
@PanagiotisCharalampous