OPEN-SOURCE SCRIPT

RedK DIY ZLMA: Customizable Zero-Lag MA (Educational / Utility)

This script is more of an educational / utility piece rather than a fully-fledged indicator - It provides an easy way to customize and produce a zero-lag Moving average that can then be used in various scenarios


What is DIY_ZLMA?
------------------------
The DIY ZLMA is for fans and enthusiasts of researching Moving Averages (like me) - the script enables the user to play around with one of the common approaches used to reduce lag in moving averages - which was explained in this old post below

TA Basics: Creating a Zero Lag Moving Average using "Mirroring"



Suggested uses of the DIY_ZLMA
---------------------------------------

* The Zero-lag approach here applies 3 moving average passes to a source data series - I'll refer to these 3 passes as Base MA Pass , De-lagging Pass, and Smoothing Pass - these "passes" can be customized from the indicator settings in terms of MA Length and type. The first pass allows the choice of a "source", and the second pass allows additional fine tuning by playing around with the magnification factor. The 3rd pass (smoothing) is optional and can be skipped altogether when needed. (as noted in the script, HMA and TEMA, which are very common low-lag MA's use slightly different approach in the calculation than the one used here .. so we can't get an equivalent of either of these MA's with the customization of DIY_ZLMA parameters)

* After the user experiments with the various settings for the 3 passes, and finds a "preferred combination", the script not only plots the resulting My_ZLMA - it also produces the "1-line Pine script formula" that the user can then use in any other script, maybe to smoothen some data series, or to combine with other types of moving averages to create multi-MA cross-over trading signals... and so on.

* The DIY_ZLMA can also be added to another indicator as a signal line using the Indicator-on-Indicator feature of TradingView (review this post for step-by-step -->

Quick tip: Add a signal line to your indicator, no coding!
)

* the script also showcases couple of recent (and very neat) Pine features: the use of User-defined Types (UDT) and User-defined Methods - which are awesome and a lot of fun to work with :)

Since this is more of a utility piece, I added as many comments as possible to the script to explain the way it works - so it's more valuable if someone finds it by searching the "Add Indicator" feature in TradingView charts

Please feel free to play around with this new toy :) and share comments and feedback below if you find this useful. I truly hope you do.
diyeducationalMoving AveragesPine utilitiesredkzerolagzlma

오픈 소스 스크립트

진정한 TradingView 정신에 따라, 이 스크립트의 저자는 트레이더들이 이해하고 검증할 수 있도록 오픈 소스로 공개했습니다. 저자에게 박수를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 출판물에서 이 코드를 재사용하는 것은 하우스 룰에 의해 관리됩니다. 님은 즐겨찾기로 이 스크립트를 차트에서 쓸 수 있습니다.

차트에 이 스크립트를 사용하시겠습니까?

면책사항