Doug Hayman Posted July 20, 2021 Report Share Posted July 20, 2021 I was wondering if this can somehow be accomplished in C# Advanced Paintbars: A couple of preliminary items: 1) I am using Renko Bars (4 points) for futures; 2) I am doing this as part of my back testing efforts; Renko bars get timestamped (TimeStamp) when the Renko bar is created. In my back testing logic, I want to close any simulated trade, say within 15 minutes of market close. So, as an example, let's say a trade fires off, and my last Renko Bar has a TimeStamp of 15:24:25. 16:00:00 comes around (15 minutes of market close), and I'm still in that same Renko bar. I cannot check the TimeStamp of the Renko Bar to see if we're at 4:00 PM, since the TimeStamp associated with that bar is 15:24:25. I tried creating a variable of type "DateTime CurTime", but I get the following error on declaration, "96, 16 CS0103 Possible security violation". Not sure that would have given me the desired result anyway, as it might provide current system time (that is, the time when I run the back test), as opposed to the current time with the Bar. Is there any way that I can check the system time, while within the Renko Bar, via logic? Thank you in advance. Quote Link to comment Share on other sites More sharing options...
Mike Medved Posted July 21, 2021 Report Share Posted July 21, 2021 DateTime.UtcNow I think is what you're looking for. But that of course is current UTC time, so it would only work for the last candle processing, not for going back. Quote Link to comment Share on other sites More sharing options...
Doug Hayman Posted July 21, 2021 Author Report Share Posted July 21, 2021 Yes, tried DateTIme.UtcNow and DateTime.Now and both provide latest date/time for any historical (or current) bar(s). Quote Link to comment Share on other sites More sharing options...
Mike Medved Posted July 21, 2021 Report Share Posted July 21, 2021 So - other than the current time - what do you need? When you look at a renko bar, there is a start time and an end time. You want to know the end time for the bar? Quote Link to comment Share on other sites More sharing options...
Doug Hayman Posted July 21, 2021 Author Report Share Posted July 21, 2021 Mike, for Renko bars "Timestamp" refers to the creation date/time of the bar. Is there a way to access the END date/time of the Renko bar? I don't see anything in the doc that would gain me access to that. And yes, that would solve my issue. For regular time-based bars, END date/time could obviously be easily derived. For Renko's I cannot derive, since we don't have bar look-ahead capabilities (for back-testing purposes, that is). Quote Link to comment Share on other sites More sharing options...
Mike Medved Posted July 22, 2021 Report Share Posted July 22, 2021 Added: TimestampEnd indexed variable - like Timestamp. Will be in next beta. 1 Quote Link to comment Share on other sites More sharing options...
Doug Hayman Posted July 22, 2021 Author Report Share Posted July 22, 2021 Excellent, that will be most useful. Thank you. Quote Link to comment Share on other sites More sharing options...
Mike Medved Posted July 22, 2021 Report Share Posted July 22, 2021 Note that TimestampEnd is the timestamp of the last tick in the candle. So for timed candles it may not be 1 min (or 5 min etc) after the candle start. It may be 30 sec or something. Depending on the ticks that go into the candle. Quote Link to comment Share on other sites More sharing options...
Doug Hayman Posted July 22, 2021 Author Report Share Posted July 22, 2021 MIke, for my purposes, that's perfect, exactly what I want. Can't speak for others when it comes to timed candles. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.