PineCoders

Averages - PineCoders FAQ

PineCoders Mod アップデート済   
█ WARNING


The publication of our ConditionalAverages library has deprecated this publication.



█ ORIGINAL DESCRIPTION


The need to calculate averages (arithmetic mean) comes up here and there in scripts. When you want the average of a value only when a given condition has occurred, you will often not be able to use the standard sma function in Pine because it will average all values in the series. Even if you take care to use your condition to set non-conforming values to zero, this ends up skewing your results with zero values.

This script calculates:
1. The running average of all up volumes,
2. The average of last x occurrences of up volume ,
3. The average up volume occurrences in last y bars.



Look first. Then leap.

リリースノート:
  • Made code for cases 2 and 3 into functions.
  • Added examples of multiple-result functions.
リリースノート:
Conversion to v4.
リリースノート:
Fixes to comments.
リリースノート:
Simplified Case 1 code.
リリースノート:
Changes to comments.
リリースノート:
Updated calculations.
リリースノート:
v8
Rewrite of code using techniques that eliminate all `for` loops.
リリースノート:
v9
Functionalized case 1.

Tools and ideas for all Pine coders: www.pinecoders.com
Our Pine FAQ & Code: www.pinecoders.com/faq_and_code/
Pine news broadcasts: t.me/PineCodersSquawkBox or twitter.com/PineCoders
オープンソーススクリプト

TradingViewの精神に則り、このスクリプトの作者は、トレーダーが理解し検証できるようにオープンソースで公開しています。作者に敬意を表します!無料で使用することができますが、このコードを投稿で再利用するには、ハウスルールに準拠する必要があります。 お気に入りに登録してチャート上でご利用頂けます。

免責事項

これらの情報および投稿は、TradingViewが提供または保証する金融、投資、取引、またはその他の種類のアドバイスや推奨を意図したものではなく、またそのようなものでもありません。詳しくは利用規約をご覧ください。

チャートでこのスクリプトを利用したいですか?