gorx1

Weighted Least Squares Moving Average

gorx1 ที่อัปเดต:   
Linearly Weighted Ordinary Least Squares Moving Regression
aka Weighted Least Squares Moving Average -> WLSMA
^^ called it this way just to for... damn, forgot the word


Totally pwns LSMA for some purposes here's why (just look up):
- 'realistically' the same smoothness;
- less lag;
- less overshoot;
- more or less same computationally intensive.

"Pretty cool, huh?", Bucky Roberts©, thenewboston

Now, would you please (just look down) and see the comparison of impulse & step responses:

Impulse responses

Step responses

Ain't it beautiful?

"Motivation behind the concept & rationale", by gorx1
Many been trippin' applying stats methods that require normally distributed data to time series, hence all these B*ll**** Bands and stuff don't really work as it should, while people blame themselves and buy snake oil seminars bout trading psychology, instead of using proper tools. Price... Neither population nor the samples are neither normally nor log-normally distributed. So we can't use all the stuff if we wanna get better results. I'm not talking bout passing each rolling window to a stat test in order to get the proper descriptor, that's the whole different story.

Instead we can leverage the fact that our data is time-series hence we can apply linear weighting, basically we extract another info component from the data and use it to get better results. Volume, range weighting don't make much sense (saying that based on both common sense and test results). Tick count per bar, that would be nice tho... this is the way to measure "intensity". But we don't have it on TV unfortunately.

Anyways, I'm both unhappy that no1 dropped it before me during all these years so I gotta do it myself, and happy that I can give smth cool to every1

Here is it, for you.

P.S.: the script contains standalone functions to calculate linearly weighted variance, linearly weighted standard deviation, linearly weighted covariance and linearly weighted correlation.

Good hunting
เอกสารเผยแพร่:
Now the offset parameter is here, so you can offset as much as you want!
เอกสารเผยแพร่:
...
เอกสารเผยแพร่:
Update:

New:
- Horizontal shift parameter - allows to displace the line horizontally. Together with offset parameter, it's possible to make short-term forecasts and display them at correct indexes.
เอกสารเผยแพร่:
New functionality!

New:
- Thanks to new matrix functionality, now you can use not only linear but also polynomial regression! Switch the "degree" parameter and see for yourself!
เอกสารเผยแพร่:
Update

Fixes:
- Matrix pseudo inverse instead of usual inverse allows to make calculations on certain matrix where usual inverse is not defined;
- 1st degree weighted linear formula is back for longer periods (316+).
เอกสารเผยแพร่:
Code maintenance

สคริปต์โอเพนซอร์ซ

ด้วยจิตวิญญาณของ TradingView อย่างแท้จริง ผู้เขียนสคริปต์นี้ได้เผยแพร่เป็นโอเพนซอร์ส เพื่อให้ผู้ค้าสามารถเข้าใจและตรวจสอบได้ ไชโยให้กับผู้เขียน! คุณสามารถใช้ได้ฟรี แต่การใช้รหัสนี้ซ้ำในสิ่งพิมพ์อยู่ภายใต้กฎระเบียบการใช้งาน คุณสามารถตั้งเป็นรายการโปรดเพื่อใช้บนชาร์ตได้

คำจำกัดสิทธิ์ความรับผิดชอบ

ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมที่ เงื่อนไขการใช้บริการ

ต้องการที่จะใช้สคริปต์นี้บนชาร์ตใช่ไหม?