LazyBear

Market Direction Indicator [LazyBear]

Market Direction Indicator (MDI), by Donald Lambert, is an extension of simple moving average cross over systems. Series of price cross over points are determined to derive MDI.

Note that the short/long lengths will differ between instruments. They need to be tuned properly.

I have added an option to specify a "cutoff" parameter. When MDI is in the cutoff zone (-/+ cutoff), bars are colored gray. Set this to zero to turn off cutoffs.

Other options:
- OverlayMode: Enable this to color bars. MDI values are not plotted. If unchecked, MDI default rendering mode is Histogram mode.
- ShowBelowZero: Plots the negative values below zero (Oscillator mode)

Use "MDI" and "ZeroLine" for setting up alerts. Make sure MDI is in OscillatorMode.

Master list of all my indicators:
docs.google.com...ByMEvm5MLo/edit?usp=sharin...

List of my free indicators: bit.ly/1LQaPK8
List of my indicators at Appstore: blog.tradingview.com/?p=970
Mã nguồn mở

Với tinh thần TradingView, tác giả của tập lệnh này đã xuất bản nó dưới dạng mã nguồn mở, vì vậy các nhà giao dịch có thể hiểu và xác minh nó. Chúc mừng tác giả! Bạn có thể sử dụng mã này miễn phí, nhưng việc sử dụng lại mã này trong một ấn phẩm chịu sự điều chỉnh của Nội quy nội bộ. Bạn có thể yêu thích nó để sử dụng nó trên biểu đồ.

Thông báo miễn trừ trách nhiệm

Thông tin và ấn phẩm không có nghĩa là và không cấu thành, tài chính, đầu tư, kinh doanh, hoặc các loại lời khuyên hoặc khuyến nghị khác được cung cấp hoặc xác nhận bởi TradingView. Đọc thêm trong Điều khoản sử dụng.

Bạn muốn sử dụng tập lệnh này trên biểu đồ?
//
// @author LazyBear 
// List of all my indicators: 
// https://docs.google.com/document/d/15AGCufJZ8CIUvwFJ9W-IKns88gkWOKBCvByMEvm5MLo/edit?usp=sharing
// 
study("Market Direction Indicator [LazyBear]", shorttitle="MDI_LB")
src=close
lenMA1=input(13, title="Short Length"), lenMA2=input(55, title="Long Length")
cutoff=input(2, title="No-trend cutoff")
sbz=input(false, title="Show Below Zero")
om=input(false, title="Enable overlay mode")
calc_cp2(src, len1, len2) =>
    (len1*(sum(src, len2-1)) - len2*(sum(src, len1-1))) / (len2-len1)

cp2=calc_cp2(src, lenMA1, lenMA2)
mdi=100*(nz(cp2[1]) - cp2)/((src+src[1])/2)
mdic=mdi<-cutoff?(mdi<mdi[1]?red:orange):mdi>cutoff?(mdi>mdi[1]?green:lime):gray
plot(om ? na : 0, color=gray, title="ZeroLine"), plot(om ? na : sbz ? mdi : abs(mdi), style=columns, color=mdic, linewidth=3, title="MDI")
barcolor(om ? mdic:na)