Market Trend Strength (MTS) (by ChartArt)

See the current trend strength of the market. An additional filter makes trend consolidation areas visible. The color changes there each bar back and forth between green and red.

This area was interesting. Would have been a better example:

If the filter is deactivated the indicator shows the last measured price trend (green for up and down for red).

从常用脚本中删除 添加到常用脚本
study(title="Market Trend Strength (MTS) (by ChartArt)", shorttitle="CA_-_MTS", overlay=true)

// Version 1.0
// Idea by ChartArt on June 3, 2015.
// This indicator is measuring if there are two
// consecutive higher or lower prices. Therefore
// it measures the trend strength of the market.
// The additional filter shows the trend before
// the trend changed the last time. This filter
// makes consolidation areas without a trend visible.
// List of my work: 

switch=input(true, title="Show consolidation areas? (The color changes there each bar)")
ShowConsolidation = 2

GetBgColor =	iff( (hl2 > hl2[1]) and (hlc3 > hlc3[1]) and (close > close[1])  and  (hl2[1] > hl2[2]) and (hlc3[1] > hlc3[2]) and (close[1] > close[2]), 1, 
	            iff( (hl2 < hl2[1]) and (hlc3 < hlc3[1]) and (close < close[1])  and  (hl2[1] < hl2[2]) and (hlc3[1] < hlc3[2]) and (close[1] < close[2]), -1, nz(GetBgColor[switch?ShowConsolidation:1], 0) ))

SelectBgColor = GetBgColor == -1 ? red: GetBgColor == 1 ? green: na

bgcolor(SelectBgColor, transp = 85)


Thanks a lot ChartArt for sharing
Hey dude,

Hope you doing well, I was looking at your script and can't figure out what are you doing here, would you mind to explain it?

nz(GetBgColor, 0)

I see that if 'switch' variable is 'true' then you pass the ShowConsolidation variable '2' else a '1' . Are you accessing the previous values in GetBgColor by passing the number inside the square brackets? is GetBgColor a serie?

Thanks in advance!
ChartArt dieggore

This is a serie and the key is the "nz". But I can't tell you any more the though process behind this script, because it's 2 years ago that I coded it, sorry.
+2 回复
首页 股票筛选器 外汇筛选器 加密货币筛选器 财经日历 如何运作 图表功能 价格 推荐朋友 网站规则 帮助中心 网站 & 经纪商解决方案 插件 图表解决方案 轻量图表库 博客 & 新闻 Twitter
概览 个人资料设置 账户和账单 推荐朋友 代币 我的客服工单 帮助中心 已发表观点 粉丝 正在关注 私人消息 在线聊天 退出