herve.va
Joined 19.09.2017
TimeSpan as parameter 19 Sep 2017, 19:43
Good afternoon,
I want to use TimeSpan as parameter with default value but don't how to do it.
Is it possible ?
afhacker 19 Sep 2017, 21:29
Use string then parse it:
using System; using System.Linq; using cAlgo.API; using cAlgo.API.Indicators; using cAlgo.API.Internals; using cAlgo.Indicators; using System.IO.Pipes; using System.Globalization; namespace cAlgo { [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)] public class Blank : Robot { private TimeSpan userTimeZone; [Parameter("Time Zone(UTC)", DefaultValue = "10:00:00")] public string UserTimeZone { get; set; } protected override void OnStart() { userTimeZone = TimeSpan.Parse(UserTimeZone, CultureInfo.InvariantCulture); } protected override void OnTick() { } protected override void OnStop() { } } }
herve.va 20 Sep 2017, 17:46
thanks afhacker, it is good.
afhacker
19 Sep 2017, 21:29
Use string then parse it:
@afhacker