Page 1 of 1
TURNOVER variable
Posted: Dec 19 2019
by siou83
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!
Re: TURNOVER variable
Posted: Dec 19 2019
by TJ
Do you need an array?
If you want to know the average, then just calculate the moving average of the "Turnover".
Re: TURNOVER variable
Posted: Dec 20 2019
by siou83
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?
Re: TURNOVER variable
Posted: Dec 20 2019
by TJ
What is your chart resolution?
Re: TURNOVER variable
Posted: Dec 20 2019
by siou83
I am looking at a daily chart at the moment
Re: TURNOVER variable
Posted: Dec 20 2019
by TJ
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 );
Re: TURNOVER variable
Posted: Dec 20 2019
by TJ
ps. see post #1 & post #2 on how to post codes
viewtopic.php?t=11713
Re: TURNOVER variable [SOLVED]
Posted: Dec 24 2019
by siou83
Thank you for the above!