# TURNOVER variable  [SOLVED]

Questions about MultiCharts and user contributed studies.
siou83
Posts: 7
Joined: 28 Oct 2019
Has thanked: 2 times

### TURNOVER variable

Hi ,

I want to create a turnover variable (defined as Close Price * Volume) and save the data as an array.
Then from that array i would like to be able to calculate average values, for example what is the average turnover over the past month, or 10 weeks etc.

Any ideas on how i can create something like this most welcome!

TJ
Posts: 7752
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1034 times
Been thanked: 2228 times

### Re: TURNOVER variable

Do you need an array?

If you want to know the average, then just calculate the moving average of the "Turnover".

siou83
Posts: 7
Joined: 28 Oct 2019
Has thanked: 2 times

### Re: TURNOVER variable

Hi TJ,

So how could i do that?

assume i define Turnover as follows:

vars: Turnover(0)

Turnover = C * Volume

How can i then calculate the moving average of the past 10 weeks of the above variable?

TJ
Posts: 7752
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1034 times
Been thanked: 2228 times

### Re: TURNOVER variable

siou83
Posts: 7
Joined: 28 Oct 2019
Has thanked: 2 times

### Re: TURNOVER variable

I am looking at a daily chart at the moment

TJ
Posts: 7752
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1034 times
Been thanked: 2228 times

### Re: TURNOVER variable

Try this:

input:
TOMA.Length( 50 ); // 50 days approx 10 weeks

vars:
Turnover( 0 ),
TOMA( 0 ); // Turnover moving average

Turnover = C * Volume ;
TOMA = Average( Turnover , TOMA.length );

TJ
Posts: 7752
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1034 times
Been thanked: 2228 times

### Re: TURNOVER variable

ps. see post #1 & post #2 on how to post codes
viewtopic.php?t=11713

siou83
Posts: 7
Joined: 28 Oct 2019
Has thanked: 2 times

### Re: TURNOVER variable  [SOLVED]

Thank you for the above!