This script calculates:
1. The running average of all up volumes,
2. The average of last x occurrences of up ,
3. The average up occurrences in last y bars.
- Made code for cases 2 and 3 into functions.
- Added examples of multiple-result functions.
Rewrite of code using techniques that eliminate all `for` loops.
Functionalized case 1.
Our Pine FAQ & Code: http://www.pinecoders.com/faq_and_code/
Pine news broadcasts: https://t.me/PineCodersSquawkBox or https://twitter.com/PineCoders
In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in a publication is governed by House Rules. You can favorite it to use it on a chart.