[IOGMode(IOGMode.Enabled)]
...
protected override void CalcBar(){
Output.WriteLine(Bars.Time[0]);
...
I then replay tick-by-tick, but the timestamps always show e.g. 15:29:00 for every tick between 15:29-15:30. How do I get the second timestamp for each tick?
Timestamps for tick data in replay always 00 seconds.
-
- Posts: 60
- Joined: 03 Mar 2011
- Has thanked: 9 times
- Been thanked: 2 times
- JoshM
- Posts: 2195
- Joined: 20 May 2011
- Location: The Netherlands
- Has thanked: 1544 times
- Been thanked: 1565 times
- Contact:
Re: Timestamps for tick data in replay always 00 seconds.
I'm not 100% sure how it works for replay, but I thought you'll need to enable the option 'Enable access to intra-bar time for calculation in intra-bar order generation mode' from the Backtesting tab of the Strategy Properties. See point 6 from this page.I then replay tick-by-tick, but the timestamps always show e.g. 15:29:00 for every tick between 15:29-15:30. How do I get the second timestamp for each tick?
-
- Posts: 60
- Joined: 03 Mar 2011
- Has thanked: 9 times
- Been thanked: 2 times
Re: Timestamps for tick data in replay always 00 seconds.
"Bar Magnifier is unavailable during data playback"
- JoshM
- Posts: 2195
- Joined: 20 May 2011
- Location: The Netherlands
- Has thanked: 1544 times
- Been thanked: 1565 times
- Contact:
Re: Timestamps for tick data in replay always 00 seconds.
If you format the DateTime string with millisecond output, it does work in Replay:
Gives as output:
Code: Select all
using System;
using System.Drawing;
using System.Linq;
using PowerLanguage.Function;
using ATCenterProxy.interop;
namespace PowerLanguage.Strategy
{
[IOGMode(IOGMode.Enabled)]
public class TimestampTickData : SignalObject
{
private IOrderMarket buy_order;
public TimestampTickData(object _ctx):base(_ctx){}
protected override void Create()
{
Output.Clear();
}
protected override void StartCalc()
{
}
protected override void CalcBar()
{
Output.WriteLine(Bars.Time[0].ToString("HH:mm:ss.fff"));
}
}
}
Code: Select all
09:13:25.948
09:13:26.088
09:13:26.237
09:13:26.260
09:13:26.270
09:13:26.313
09:13:26.447
09:13:26.456
09:13:26.508
09:13:26.576
09:13:26.617
09:13:26.853
-
- Posts: 60
- Joined: 03 Mar 2011
- Has thanked: 9 times
- Been thanked: 2 times
Re: Timestamps for tick data in replay always 00 seconds.
Thanks!
Hmmn, this must be the way I have something setup, as my output on tick-by-tick replay looks like:
15:35:00.000
15:35:00.000
15:36:00.000
15:36:00.000
15:36:00.000
15:36:00.000
15:36:00.000
15:36:00.000
15:36:00.000
15:36:00.000
15:36:00.000
15:36:00.000
15:36:00.000
15:36:00.000
15:36:00.000
15:36:00.000
15:37:00.000
15:37:00.000
15:37:00.000
15:37:00.000
15:38:00.000
.....
Hmmn, this must be the way I have something setup, as my output on tick-by-tick replay looks like:
15:35:00.000
15:35:00.000
15:36:00.000
15:36:00.000
15:36:00.000
15:36:00.000
15:36:00.000
15:36:00.000
15:36:00.000
15:36:00.000
15:36:00.000
15:36:00.000
15:36:00.000
15:36:00.000
15:36:00.000
15:36:00.000
15:37:00.000
15:37:00.000
15:37:00.000
15:37:00.000
15:38:00.000
.....
- JoshM
- Posts: 2195
- Joined: 20 May 2011
- Location: The Netherlands
- Has thanked: 1544 times
- Been thanked: 1565 times
- Contact:
Re: Timestamps for tick data in replay always 00 seconds.
Hm, odd. It looks like you don't even have second data, let alone millisecond data.Thanks!
Hmmn, this must be the way I have something setup, as my output on tick-by-tick replay looks like:
15:35:00.000
15:35:00.000
15:36:00.000
15:36:00.000
15:36:00.000
15:36:00.000
15:36:00.000
15:36:00.000
15:36:00.000
15:36:00.000
15:36:00.000
15:36:00.000
15:36:00.000
15:36:00.000
15:36:00.000
15:36:00.000
15:37:00.000
15:37:00.000
15:37:00.000
15:37:00.000
15:38:00.000
.....
Do you have tick data for that selected symbol?
I tested it on a 250 tick bar chart, with the Replay set to 'tick by tick'.
-
- Posts: 60
- Joined: 03 Mar 2011
- Has thanked: 9 times
- Been thanked: 2 times
Re: Timestamps for tick data in replay always 00 seconds.
Ah yes, I just realised the reason for my confusion.
My chart is on minute data, but I am replaying tick-by-tick. However, I would like to know the timestamp for seconds, for each tick, but from a minute chart.
My chart is on minute data, but I am replaying tick-by-tick. However, I would like to know the timestamp for seconds, for each tick, but from a minute chart.
- JoshM
- Posts: 2195
- Joined: 20 May 2011
- Location: The Netherlands
- Has thanked: 1544 times
- Been thanked: 1565 times
- Contact:
Re: Timestamps for tick data in replay always 00 seconds.
You're right, on a minute chart it doesn't display seconds nor milliseconds.Ah yes, I just realised the reason for my confusion.
My chart is on minute data, but I am replaying tick-by-tick. However, I would like to know the timestamp for seconds, for each tick, but from a minute chart.
I got this on the same symbol (same data) but with a five minute chart (with data replay set to 'tick by tick'):
Code: Select all
03:05:00.000
03:05:00.000
03:05:00.000
03:05:00.000
03:05:00.000
03:05:00.000
03:05:00.000
03:05:00.000
Code: Select all
07:35:00.000
07:35:00.000
07:35:00.000
07:35:00.000
07:35:00.000
07:35:00.000
07:35:00.000
07:35:00.000
07:35:00.000
07:35:00.000
07:35:00.000
07:35:00.000
07:35:00.000
07:35:00.000
07:35:00.000
07:35:00.000
07:35:00.000
07:35:00.000
07:35:00.000
07:35:00.000
07:35:00.000
07:35:00.000
07:35:00.000
07:35:00.000
07:35:00.000
07:35:00.000
07:35:00.000
07:35:00.000
07:35:00.000
07:35:00.000
Last edited by JoshM on 24 Sep 2013, edited 1 time in total.
-
- Posts: 60
- Joined: 03 Mar 2011
- Has thanked: 9 times
- Been thanked: 2 times
Re: Timestamps for tick data in replay always 00 seconds.
Is there any sort of workaround? I could really do with second timestamps for tracking purposes....
- JoshM
- Posts: 2195
- Joined: 20 May 2011
- Location: The Netherlands
- Has thanked: 1544 times
- Been thanked: 1565 times
- Contact:
Re: Timestamps for tick data in replay always 00 seconds.
If you're backtesting your strategy, you could useIs there any sort of workaround? I could really do with second timestamps for tracking purposes....
Code: Select all
Bars.BarUpdateTime.ToString("HH:mm:ss.fff")
If you're autotrading your strategy, you could use
Code: Select all
DateTime.Now.ToString("HH:mm:ss.fff")
--------------
@MultiCharts Support, I noticed that second and millisecond timestamps also aren't available when the strategy is run on real-time data (when the chart is a minute chart), while on tick charts the above code runs as expected. So this limitation is not only with the Data Replay.
This limitation probably stems from the original MultiChart, where Time_s returns the closing time of the bar. However, as the above shows, this is also limiting.
Could we get a DateTime property that returns the time of the last tick in real-time data and Data Replay calculation? That would be very useful.
The already existing Bars.BarUpdateTime could be used for this, so that it will always return the DateTime with milliseconds; in backtesting with Bar Magnifier, in Data Replay, and in real-time calculation. The Bars.Time[0] can then be used to get the closing time of the bar (as it is now).
-------------------
Issue #2:
Speaking of a workaround, I thought that retrieving the Status Line timestamp will include the milliseconds (as it is displayed with milliseconds on the chart). But that doesn't work:
250 tick chart on real-time data:
Code: Select all
using System;
using System.Drawing;
using System.Linq;
using PowerLanguage.Function;
using ATCenterProxy.interop;
namespace PowerLanguage.Strategy
{
[IOGMode(IOGMode.Enabled)]
public class TimestampTickData : SignalObject
{
public TimestampTickData(object _ctx):base(_ctx){}
protected override void CalcBar()
{
Output.WriteLine("Bars.Time: {0}, Bars.BarUpdateTime: {1}, Bars.StatusLine.Time: {2}",
Bars.Time[0].ToString("HH:mm:ss.fff"),
Bars.BarUpdateTime.ToString("HH:mm:ss.fff"),
Bars.StatusLine.Time.ToString("HH:mm:ss.fff"));
}
}
}
Code: Select all
Bars.Time: 13:57:33.506, Bars.BarUpdateTime: 13:57:33.506, Bars.StatusLine.Time: 13:57:33.000
Bars.Time: 13:57:33.605, Bars.BarUpdateTime: 13:57:33.605, Bars.StatusLine.Time: 13:57:33.000
Bars.Time: 13:57:33.658, Bars.BarUpdateTime: 13:57:33.658, Bars.StatusLine.Time: 13:57:33.000
Bars.Time: 13:57:35.315, Bars.BarUpdateTime: 13:57:35.315, Bars.StatusLine.Time: 13:57:35.000
Bars.Time: 13:57:35.800, Bars.BarUpdateTime: 13:57:35.800, Bars.StatusLine.Time: 13:57:35.000
Bars.Time: 13:57:35.982, Bars.BarUpdateTime: 13:57:35.982, Bars.StatusLine.Time: 13:57:35.000
Bars.Time: 13:57:37.722, Bars.BarUpdateTime: 13:57:37.722, Bars.StatusLine.Time: 13:57:37.000
Bars.Time: 13:57:43.508, Bars.BarUpdateTime: 13:57:43.508, Bars.StatusLine.Time: 13:57:43.000
Bars.Time: 13:57:44.076, Bars.BarUpdateTime: 13:57:44.076, Bars.StatusLine.Time: 13:57:44.000
Bars.Time: 13:57:44.931, Bars.BarUpdateTime: 13:57:44.931, Bars.StatusLine.Time: 13:57:45.000
Bars.Time: 13:57:45.020, Bars.BarUpdateTime: 13:57:45.020, Bars.StatusLine.Time: 13:57:45.000
Bars.Time: 13:57:45.112, Bars.BarUpdateTime: 13:57:45.112, Bars.StatusLine.Time: 13:57:45.000
Bars.Time: 13:57:45.208, Bars.BarUpdateTime: 13:57:45.208, Bars.StatusLine.Time: 13:57:45.000
Bars.Time: 13:57:45.587, Bars.BarUpdateTime: 13:57:45.587, Bars.StatusLine.Time: 13:57:45.000
Bars.Time: 13:57:45.906, Bars.BarUpdateTime: 13:57:45.906, Bars.StatusLine.Time: 13:57:45.000
Bars.Time: 13:57:46.141, Bars.BarUpdateTime: 13:57:46.141, Bars.StatusLine.Time: 13:57:46.000
Bars.Time: 13:57:46.437, Bars.BarUpdateTime: 13:57:46.437, Bars.StatusLine.Time: 13:57:46.000
Bars.Time: 13:57:49.335, Bars.BarUpdateTime: 13:57:49.335, Bars.StatusLine.Time: 13:57:49.000
Bars.Time: 13:57:50.707, Bars.BarUpdateTime: 13:57:50.707, Bars.StatusLine.Time: 13:57:50.000
Bars.Time: 13:57:50.839, Bars.BarUpdateTime: 13:57:50.839, Bars.StatusLine.Time: 13:57:50.000
Bars.Time: 13:57:51.705, Bars.BarUpdateTime: 13:57:51.705, Bars.StatusLine.Time: 13:57:51.000
Bars.Time: 13:57:51.736, Bars.BarUpdateTime: 13:57:51.736, Bars.StatusLine.Time: 13:57:51.000
Bars.Time: 13:57:52.031, Bars.BarUpdateTime: 13:57:52.031, Bars.StatusLine.Time: 13:57:52.000
Bars.Time: 13:57:52.325, Bars.BarUpdateTime: 13:57:52.325, Bars.StatusLine.Time: 13:57:52.000
Bars.Time: 13:57:52.412, Bars.BarUpdateTime: 13:57:52.412, Bars.StatusLine.Time: 13:57:52.000
Bars.Time: 13:57:52.528, Bars.BarUpdateTime: 13:57:52.528, Bars.StatusLine.Time: 13:57:52.000
Bars.Time: 13:57:52.613, Bars.BarUpdateTime: 13:57:52.613, Bars.StatusLine.Time: 13:57:52.000
Bars.Time: 13:57:52.712, Bars.BarUpdateTime: 13:57:52.712, Bars.StatusLine.Time: 13:57:52.000
Bars.Time: 13:57:52.924, Bars.BarUpdateTime: 13:57:52.924, Bars.StatusLine.Time: 13:57:52.000
Bars.Time: 13:57:53.007, Bars.BarUpdateTime: 13:57:53.007, Bars.StatusLine.Time: 13:57:53.000
Bars.Time: 13:57:53.125, Bars.BarUpdateTime: 13:57:53.125, Bars.StatusLine.Time: 13:57:53.000
Bars.Time: 13:57:53.427, Bars.BarUpdateTime: 13:57:53.427, Bars.StatusLine.Time: 13:57:53.000
Bars.Time: 13:57:54.183, Bars.BarUpdateTime: 13:57:54.183, Bars.StatusLine.Time: 13:57:54.000
Bars.Time: 13:57:54.420, Bars.BarUpdateTime: 13:57:54.420, Bars.StatusLine.Time: 13:57:54.000
Bars.Time: 13:57:56.514, Bars.BarUpdateTime: 13:57:56.514, Bars.StatusLine.Time: 13:57:56.000
-
- Posts: 60
- Joined: 03 Mar 2011
- Has thanked: 9 times
- Been thanked: 2 times
Re: Timestamps for tick data in replay always 00 seconds.
Thanks a lot!
Just to clarify, for myself as much as other people:
Bars.BarUpdateTime - provides second/millisecond timestamps on a e.g. minute chart. We need to use the Bar Magnifier and "Enable access to intra-bar time calculation in Intra-Bar Order Generation mode."
However, Bars.BarUpdateTime does not provide second/millisecond timestamps in replay mode.
Just to clarify, for myself as much as other people:
Bars.BarUpdateTime - provides second/millisecond timestamps on a e.g. minute chart. We need to use the Bar Magnifier and "Enable access to intra-bar time calculation in Intra-Bar Order Generation mode."
However, Bars.BarUpdateTime does not provide second/millisecond timestamps in replay mode.
- JoshM
- Posts: 2195
- Joined: 20 May 2011
- Location: The Netherlands
- Has thanked: 1544 times
- Been thanked: 1565 times
- Contact:
Re: Timestamps for tick data in replay always 00 seconds.
A) There seems no way to get the time of the last real-time trade (since Bars.Time[0] gives the bar closing time on a time-based chart).
B) The Status Line Time property does not include milliseconds.
B) The Status Line Time property does not include milliseconds.
-
- Posts: 60
- Joined: 03 Mar 2011
- Has thanked: 9 times
- Been thanked: 2 times
Re: Timestamps for tick data in replay always 00 seconds.
Out of interest, where can I find/download the latest beta?Hello AntiMatter,
This issue has been confirmed. It will be resolved in MultiCharts .NET 8.8 Beta 1.
- JoshM
- Posts: 2195
- Joined: 20 May 2011
- Location: The Netherlands
- Has thanked: 1544 times
- Been thanked: 1565 times
- Contact:
Re: Timestamps for tick data in replay always 00 seconds.
On the download page (after it's available, of course). The link to this page can be found in the links at the top of every page: MultiCharts .NET --> Download.Out of interest, where can I find/download the latest beta?
New beta versions will normally be communicated on the forum and the blog. The blog will also have the changelog for the new version.
- Henry MultiСharts
- Posts: 9165
- Joined: 25 Aug 2011
- Has thanked: 1264 times
- Been thanked: 2957 times
Re: Timestamps for tick data in replay always 00 seconds.
That is correct. Bars.BarUpdateTime is a feature for Bar Magnifier only. It works disregard the "Enable access to intra-bar time calculation in Intra-Bar Order Generation mode" option.Bars.BarUpdateTime - provides second/millisecond timestamps on a e.g. minute chart. We need to use the Bar Magnifier and "Enable access to intra-bar time calculation in Intra-Bar Order Generation mode." However, Bars.BarUpdateTime does not provide second/millisecond timestamps in replay mode.
A) There seems no way to get the time of the last real-time trade (since Bars.Time[0] gives the bar closing time on a time-based chart).
That is correct, unfortunately there is no way to do that at the moment. Please submit a feature request to the Project Management of our web site so other users can vote for it: https://www.multicharts.com/pm/Could we get a DateTime property that returns the time of the last tick in real-time data and Data Replay calculation? That would be very useful.
This issue has been confirmed. It will be resolved in MultiCharts .NET 8.8 Beta 1.B) The Status Line Time property does not include milliseconds.
- JoshM
- Posts: 2195
- Joined: 20 May 2011
- Location: The Netherlands
- Has thanked: 1544 times
- Been thanked: 1565 times
- Contact:
Re: Timestamps for tick data in replay always 00 seconds.
Thanks Henry.
Please vote for it if you also like to see this implemented. Thanks.
I've added a feature request here:A) There seems no way to get the time of the last real-time trade (since Bars.Time[0] gives the bar closing time on a time-based chart).That is correct, unfortunately there is no way to do that at the moment. Please submit a feature request to the Project Management of our web site so other users can vote for it: https://www.multicharts.com/pm/Could we get a DateTime property that returns the time of the last tick in real-time data and Data Replay calculation? That would be very useful.
Please vote for it if you also like to see this implemented. Thanks.