TURNOVER variable  [SOLVED]

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

TURNOVER variable

Postby siou83 » 19 Dec 2019

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!

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: TURNOVER variable

Postby TJ » 19 Dec 2019

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

Postby siou83 » 20 Dec 2019

Hi TJ,

thanks for your quick reply!

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?

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: TURNOVER variable

Postby TJ » 20 Dec 2019

What is your chart resolution?

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

Re: TURNOVER variable

Postby siou83 » 20 Dec 2019

I am looking at a daily chart at the moment

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: TURNOVER variable

Postby TJ » 20 Dec 2019

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

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: TURNOVER variable

Postby TJ » 20 Dec 2019

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]

Postby siou83 » 24 Dec 2019

Thank you for the above!


Return to “MultiCharts”