I am developing a tick based indicator and want to verify what I have learned so far as well as to ask a question or two.
First, the following is what I have learned so far. Please verify that the following is true:
1) All indicator code should go into the OnBarUpdate() method.
2) In the Initialize() method, set CalculateOnBarClose to false so that the OnBarUpdate() method is called for each tick.
3) GetCurrentBid(), GetCurrentAsk(), GetCurrentBidVolume(), GetCurrentAskVolume() return the most recent values for each of these items and are OK to call for each tick.
4) The current tick price is the value in the Close[0] data series. This is the price of the last trade or the most recent price. So ...
5) FirstTickOfBar() will be true when OnBarUpdate() is called for the first tick of a new bar.
6) Volume[0] returns the cumulative volume for the current bar. It is a running total that is reset at the start of each new bar. To determine the tick volume, we can use FirstTickOfBar() and Volume[0] like this:
double tickVolume;
if (FirstTickOfBar() == true)
{
tickVolume = Volume[0] - lastVolume;
lastVolume = Volume[0];
--------
Please confirm that the preceding is correct.
Now for a question:
So far the only transaction time I have found is Time[0], the start time of the current bar. I have been unable to find a way to determine the time of the current tick.
Is there a way to determine the time of the current tick?
Thank you.
Comment