Tick processing and tick timestamps

Questions about MultiCharts .NET and user contributed studies.
rexii2323
Posts: 1
Joined: 14 Aug 2013

Tick processing and tick timestamps

Postby rexii2323 » 15 Aug 2013

Hi,

I found this previous thread on how bar ticks are processed here:
viewtopic.php?f=19&t=13102
and it has been a great help, especially the sample code. Which shows the last tick volume by comparing the current TrueVolume vs previous tick TrueVolume

What I’m trying to do is almost the same but with the tick's timestamp. I wish to find and plot the time difference in milliseconds between the current tick & the previous tick as an indicator for each constant volume bar (painting only the minimum difference that occurred for all ticks within the CVB)

I saw here:
viewtopic.php?f=16&t=18785
that there is a MillisecondsFromDateTime function but it appears to only work for the non .NET version of Multicharts. Can anyone help me with this? I’ve tried going through all the .NET material available and I still cannot find a solution.

In addition, the sample code appears to be only working for time based bars and not tick bars or CVB (which I’m using). From the code, I do not understand why it will only work for time bars. Is there a way to get this solution to work for tick bars or CVB?

Update:
I've did a bit more digging around and I have found that there are 2 ways of doing this:
1: using 2 charts and then using BarsOfData()
2: using DataLoader

1 seem to be much easier for the moment and I've came up with something using:

Code: Select all

if (Environment.IsRealTimeCalc && BarsOfData(1).LastBarOnChart)
{
currentTickTimestamp = BarsOfData(2).Time[0].Ticks;
prevTickTimestamp =BarsOfData(2).Time[1].Ticks;
delta = (currentTickTimestamp - prevTickTimestamp)*1E-4;
if(delta < min_delta)
min_delta=delta;
plot1.Set(min_delta);
}
where BarsOfData(1) is a 5min chart
and BarsOfData(2) is a 1 tick chart

The major issue with this method is real time data is needed for this to be calculated correctly.
The 2nd issue is that this still does not work at all if I use CVB charts for BarsOfData(1). It appears that BarsOfData(1).LastBarOnChart always returns false for CVB charts!
The last issue is that by having a second instrument chart on the window of 1tick width, my first chart's width is all messed up.

Can anyone help me with these 3 issues?
Thanks
Eric

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: Tick processing and tick timestamps

Postby Henry MultiСharts » 23 Aug 2013

Hello rexii2323,

That is posible to utilize milliseconds in MultiCharts .Net as well.
Please change Ticks to Milliseconds in your code:

Code: Select all

currentTickTimestamp = BarsOfData(2).Time[0].Ticks;
prevTickTimestamp =BarsOfData(2).Time[1].Ticks;
to

Code: Select all

currentTickTimestamp = BarsOfData(2).Time[0].Millisecond;
prevTickTimestamp =BarsOfData(2).Time[1].Millisecond;

jojo

Re: Tick processing and tick timestamps

Postby jojo » 17 May 2016

Hello
How can I plot the TimeSpan on the chart? I have problem , when converting TimeSpan to a double ,maybe you can give solution?
Thanks
Jojo

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: Tick processing and tick timestamps

Postby Henry MultiСharts » 17 May 2016

Hello
How can I plot the TimeSpan on the chart? I have problem , when converting TimeSpan to a double ,maybe you can give solution?
Thanks
Jojo
Hello jojo,

You can display it as a string plot or using text drawing tools. Please refer to the following page for more details: 4.3_Plotting_on_the_Chart.


Return to “MultiCharts .NET”