Xhen Nguyen
New Member
- 2
- 1
Mình đang có code indicator như này trên Trading View, nhưng mà giờ mình muốn có indi đó ở trong MT5, mà mình lại không hiểu gì về MQL5
Ai giúp mình chuyển qua được không ạ
//@version=5
indicator(title="RSI", format=format.price, timeframe="", timeframe_gaps=true)
//RSI source
len = 14
src = close
rsi = ta.rsi(src, len)
//RSI div source
src_fast = close
len_fast = input(5)
src_slow = close
len_slow = input(14)
up_fast = ta.rma(math.max(ta.change(src_fast), 0), len_fast)
down_fast = ta.rma(-math.min(ta.change(src_fast), 0), len_fast)
rsi_fast = down_fast == 0 ? 100 : up_fast == 0 ? 0 : 100 - 100 / (1 + up_fast / down_fast)
up_slow = ta.rma(math.max(ta.change(src_slow), 0), len_slow)
down_slow = ta.rma(-math.min(ta.change(src_slow), 0), len_slow)
rsi_slow = down_slow == 0 ? 100 : up_slow == 0 ? 0 : 100 - 100 / (1 + up_slow / down_slow)
divergence = rsi_fast - rsi_slow
//RSI display
plot(rsi, title="RSI", linewidth=2, color=#2962FF)
//RSI div display
plotdiv = plot( divergence, title="RSI Div", color=#2EAF94, linewidth=2)
//Level line
b0 = hline(0, title="RSI 0", color=#787B86, linestyle=hline.style_dashed)
b15 = hline(15, title="RSI 15", color=#787B86, linestyle=hline.style_dashed)
bm15 = hline(-15, title="RSI -15", color=#787B86, linestyle=hline.style_dashed)
fill(b15, bm15, title="Background 15 -15", color=color.new(color.orange, 90))
hline(50, title="RSI 50", color=#787B86, linestyle=hline.style_dashed)
hline(90, title="RSI90", color=#ffffff, linestyle=hline.style_dotted)
b70 = hline(70, title="RSI 70", color=#787B86, linestyle=hline.style_dashed)
b30 = hline(30, title="RSI 30", color=#787B86, linestyle=hline.style_dashed)
b65 = hline(65, title="RSI 70", color=#787B8665, linestyle=hline.style_solid)
b35 = hline(35, title="RSI 30", color=#787B8665, linestyle=hline.style_solid)
fill(b70, b65, title="Background top", color=#0085FF15)
fill(b35, b65, title="Background mid", color=#8000FF15)
fill(b30, b35, title="Background bot", color=#0085FF15)
Đính kèm
Giới thiệu sách Trading hay
Thấu hiểu Hành vi giá Thị trường Tài chính - Understanding Price Action
Là quyển sách hướng dẫn giao dịch Phương Pháp Price Action của Bob Volman, chỉ sử dụng duy nhất một đường MA và cấu trúc thị trường cùng hành vi giá để tìm kiếm lợi nhuận
Bài viết liên quan