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);
}
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