Madrid

Madrid Trend Strength

MTS
590
mts
This indicator displays a vector that measures the direction and the strength of a trend. It is based on the Awesome Indicator (AO), the difference is this indicator can be customized to track different moving averages and keep track of either long or short term trends. It displays momentum direction too.
The parameters needed are two mandatory and three optional.
1. Fast MA Length. The length of the fast Moving Average
2. Slow MA Length. The length of the slow Moving Average (SlowMA > FastMA)
3. Signal Length. This is used to display the momentum.
4. Display Signal. Optionally the signal to determine momentum can be displayed as well.
5. Reverse view.
The default parameters are 34-89, but the values depend on which MA pairs you want to study, like 8-21, 21-55, 55-89, 55-144.
How to trade with the MTS indicator
1. Go long when the indicator is green
2. Go short when the indicator is red
3. If MTS is >0 and green : Long position
4. If MTS > 0 and red : entry/exit points. Take profits or scale up
5. If MTS < 0 and red : Short position
6. If MTS < 0 and green : entry/exit points. Take profits or scale up

Momentum Bar:
Lime = an uptrend in progress
Green = Still in uptrend but this signals a weakening trend or a possible reversal
Red = a downtrend in progress
Maroon = Still in downtrend but this signals a weakening trend or a possible reversal

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

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

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

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

ต้องการที่จะใช้สคริปต์นี้บนชาร์ตใช่ไหม?
// Madrid : 02/21/2104 : TrendStrength : 2.0 : This meassure the percentage
// Madrid : 05/29/2014 : 2.1 : Added the MTM indicator.
// Madrid : 05/31/2014 : 2.2 : Replaced src hl2 instead of close
// Madrid : 05/31/2014 : 2.3 : Parameter consolidation
// of the difference between two moving averages and determines the 
// strength and direction of the price move.
// The greater the number the stronger the move. A gray area is defined 
// around 3.5%, below this mark the market may become choppy.
// The Madrid Trend Strength Oscillator is based on the Awesome Oscillator,
// the difference is that the Madrid Trend Strength uses ema instead of sma
// which reduces the lagging of the sma.

study(title="Madrid Trend Strength", shorttitle="MTS", precision=2)
src =  hl2

// Input parameters
fastMALength = input(34, minval=1, title="Fast Length")
slowMALength = input(89, minval=1, title="Slow Length")
tsMA = input(13, title="Trend Strength MA")
displayMA = input(false, title="Display Trend MA")
reverseView = input(false, title="Reverse View")

fastMA = ema(src, fastMALength )
slowMA = ema(src, slowMALength )
trendStrength = reverseView? -1*(fastMA - slowMA)*100/slowMA : (fastMA - slowMA)*100/slowMA
threshold = 0
trendStrengthMA = sma(trendStrength, tsMA)

momentum = trendStrength-trendStrengthMA
colorMom = momentum>0 and change(momentum)>=0 ? lime
           : momentum>0 and change(momentum)< 0 ? green
           : momentum<0 and change(momentum)>=0 ? maroon 
           : momentum<0 and change(momentum)< 0 ? red
           : gray

colorTrend = change(trendStrength) > 0 ? green : red

// Output
plot(trendStrength, color=colorTrend, style=histogram, linewidth=2, title="TrendStrength")
plot(0, color=colorMom, style=line, linewidth=3, title="Divergence")
plot(displayMA?trendStrengthMA:na, color=change(trendStrengthMA[2])>0?green:red, linewidth=3)