Calculating Turnover from Tick Data  [SOLVED]

Questions about MultiCharts and user contributed studies.
avme
Posts: 21
Joined: 30 Oct 2013
Has thanked: 1 time
Been thanked: 2 times

Calculating Turnover from Tick Data

Postby avme » 04 Jan 2015

Hi all,

I want to use esignal real time tick data to reconstruct the turnover in Market Scanner.
I can show date, time, Last and tradevolume separately in Market Scanner. So the reception is working in real time. But when I try to show this:

Code: Select all

Var: Turnover(0);
Turnover = Last * Tradevolume;
Market Scanner shows "Not verified".

I googled for "multicharts turnover" and it showed very few results.
Is turnover calculation not possible in Multicharts?

User avatar
JoshM
Posts: 2195
Joined: 20 May 2011
Location: The Netherlands
Has thanked: 1544 times
Been thanked: 1565 times
Contact:

Re: Calculating Turnover from Tick Data

Postby JoshM » 05 Jan 2015

Code: Select all

Var: Turnover(0);
Turnover = Last * Tradevolume;
Market Scanner shows "Not verified".
Such a message is separate from being able to calculate turnover from tick data. Instead, it suggests something in your script is off. Did compiling the indicator went okay?

Is this code your complete indicator? If so, a `Plot` is needed to display data in the Market Scanner. Like so:

Code: Select all

Var: Turnover(0);

Turnover = Last * Tradevolume;
Plot1(Turnover, "Turnover");

avme
Posts: 21
Joined: 30 Oct 2013
Has thanked: 1 time
Been thanked: 2 times

Re: Calculating Turnover from Tick Data

Postby avme » 05 Jan 2015

Hi Josh,

I did have the plot syntax as you suggested. But I have a mistake in the code provided. My previous code is for the trade size (i.e. last * tradevolume) which can be calculated and shown correctly. But when I try to cumulate the trade size for turnover. The "not verified" error occurred in Market Scanner. The right code should be:

Code: Select all

Var: Turnover(0);
Turnover = Turnover + Last * Tradevolume;
Plot1(Turnover, "Turnover");
Welcome to any comments and suggestions.

User avatar
JoshM
Posts: 2195
Joined: 20 May 2011
Location: The Netherlands
Has thanked: 1544 times
Been thanked: 1565 times
Contact:

Re: Calculating Turnover from Tick Data

Postby JoshM » 05 Jan 2015

I cannot replicate that error on MultiCharts64 Version 9.0 Release (Build 10014); your code runs fine here.

If I adjust your code to see if the indicator receives the correct data (by comparing it to the other Market Scanner columns), it seems to work correctly:

Image

Code: Select all

Variables:
IntraBarPersist Turnover(0);

if (LastBarOnChart_s) then
Turnover = Turnover + (Last * Tradevolume);

Plot1(Last, "Last");
Plot2(TradeVolume, "Size");
Plot3(Turnover, "Turnover");
Attachments
scr.05-01-2015 07.23.26.png
(4.36 KiB) Downloaded 546 times

avme
Posts: 21
Joined: 30 Oct 2013
Has thanked: 1 time
Been thanked: 2 times

Re: Calculating Turnover from Tick Data

Postby avme » 05 Jan 2015

Strange enough. I cannot replicate the error myself....Thanks Josh. Really appreciate your help.

I have got a follow-up.
What I learnt is that all real time data are stored in the cache. So it is not possible to look back the data until it is stored in the QuoteManager. So if I start multicharts one hour after the market opens, how can I force MC to calculate the previous one hour turnover so that I can get the latest turnover of the day?

Thanks

User avatar
JoshM
Posts: 2195
Joined: 20 May 2011
Location: The Netherlands
Has thanked: 1544 times
Been thanked: 1565 times
Contact:

Re: Calculating Turnover from Tick Data

Postby JoshM » 05 Jan 2015

What I learnt is that all real time data are stored in the cache. So it is not possible to look back the data until it is stored in the QuoteManager. So if I start multicharts one hour after the market opens, how can I force MC to calculate the previous one hour turnover so that I can get the latest turnover of the day?
You can't, because Last and TradeVolume are quote fields (meaning, they are only available with real-time data).

If you set the data series in the Market Scanner to 1 tick, you can however calculate it on historical data. Then you could use Close for the closing price (instead of Last) and Ticks for the volume accompanying that tick (instead of TradeVolume).

Of course, this will also work on other historical time frames (like 30 seconds), but then it's less accurate since there is no keyword for the average price of a bar.

avme
Posts: 21
Joined: 30 Oct 2013
Has thanked: 1 time
Been thanked: 2 times

Re: Calculating Turnover from Tick Data  [SOLVED]

Postby avme » 05 Jan 2015

Your answer gives me a good start. Thanks again Josh.


Return to “MultiCharts”