Hi,

the title says it all.

In one of my strategies the buy and sell actions happen within the OnData() function. I would like to force them to happen between a certain timeframe.

 

So far I had success doing it but only with hours, with a fragment of code like this one, (this is c#);

public override void OnData(Slice data) { if (!Portfolio.Invested) { if (Time.Hour>Convert.ToDouble(GetParameter("start trading hour")) && Time.Hour<Convert.ToDouble(GetParameter("end trading hour"))){ foreach (var universe in UniverseManager.Values) {

So basically let's say that  Time..Hour>10 and Time.Hour<15 works well in my strategy, the problem is that I want also to use minutes. And if I want to use minutes, to, let's say, trade only between 10:20 and 15:10, it doesn't work (obviously) and I couldn't find a better solution.

 

Thanks