อินดิเคเตอร์สำหรับ TradingView · แสดงในหน้าต่างของตัวเองTradingView indicator · draws in its own pane
RSI Cross Alert
RSI แบบคลาสิกพร้อมแถบบนล่างที่ปรับได้ เส้นเฉลี่ยของ RSI (เลือก Bollinger Bands ได้) และไดเวอร์เจนซ์แบบปกติที่เปิดได้ สิ่งที่เพิ่มคือมาร์กเกอร์ยอดและก้น: เมื่อ RSI ที่อยู่ในโซนซื้อมากเกินหันลง สามเหลี่ยมแดงจะแสดงเหนือยอดนั้น และเมื่อ RSI ในโซนขายมากเกินหันขึ้น สามเหลี่ยมเขียวจะแสดงใต้ก้นนั้น alert ที่มีในโค้ดมีแค่สองแบบสำหรับไดเวอร์เจนซ์ กราฟทุกอันในหน้านี้เป็นกราฟจริงที่กดได้: ราคาอยู่ด้านบน หน้าต่างของ RSI อยู่ด้านล่าง เลื่อนเมาส์ไปบนแท่งไหน ค่าในหน้าต่างจะแสดงตามแท่งนั้น กด ตั้งค่า เพื่อเปิดแผงตั้งค่าแบบเดียวกับบน TradingViewA classic RSI with adjustable bands, an average of the RSI (with optional Bollinger Bands) and optional regular divergence. What it adds is peak and trough markers: when RSI turns down from the overbought zone a red triangle marks that high, and when it turns up from the oversold zone a green one marks that low. The code’s only alerts are two divergence conditions. Every chart on this page is live: price on top, the RSI pane below. Move the cursor over a bar to read that bar in the pane, and press Settings for the same settings you have on TradingView.
ส่วนที่ 1Part 1
เส้น RSI และแถบThe RSI and its bands
1โมดูลนี้คืออะไรWhat it is
RSI วัดความเร็วและขนาดของการเคลื่อนที่ของราคา อยู่ระหว่าง 0 ถึง 100 เส้นสีม่วง ค่าเริ่มต้นใช้ 14 แท่งและราคาปิด โซนเหนือ Upper Band (70) คือซื้อมากเกิน ใต้ Lower Band (30) คือขายมากเกิน พื้นสีม่วงอ่อนระหว่างสองแถบ เส้นจางที่ 50 เมื่อ RSI ขึ้นเกินแถบบน ช่วงที่เกินจะแรเงาเขียว เข้มขึ้นเมื่อเข้าใกล้ 100 เมื่อลงต่ำกว่าแถบล่างแรเงาแดง เข้มขึ้นเมื่อเข้าใกล้ 0RSI measures the speed and size of price moves on a 0 to 100 scale; the purple line, 14 bars of the close by default. Above the Upper Band (70) is overbought, below the Lower Band (30) oversold, with a light purple fill between and a faint line at 50. Past the upper band the overshoot is shaded green, deeper towards 100; past the lower band red, deeper towards 0.
โค้ดประกาศ timeframe = "" TradingView จึงเพิ่มช่อง Timeframe และ Wait for timeframe closes ให้เอง ใช้คำนวณบนไทม์เฟรมอื่น ค่าเริ่มต้นคือไทม์เฟรมของกราฟThe code declares timeframe = "", so TradingView adds a Timeframe and a Wait for timeframe closes input of its own, to compute on another timeframe; by default the chart's own.
2อ่านบนกราฟยังไงReading it on the chart
- RSI ค่าล่าสุดอยู่บนแกนขวาRSI , its latest value on the right axis
- แรเงาเกินแถบ เขียวเหนือแถบบน แดงใต้แถบล่างShading past a band green above the upper red below the lower
3ปรับแล้วได้อะไรWhat each setting changes
เรียงตามหน้าตั้งค่าบน TradingView ปุ่มสีทองในแต่ละข้อจะเปลี่ยนค่าบนกราฟด้านบนให้ดูทันทีIn the order TradingView lists them. The gold buttons change the chart above so you can see the effect.
RSI SettingsRSI และแถบRSI and bands3
จำนวนแท่งของ RSI ค่าน้อยเร็วและแตะแถบบ่อยBars in the RSI; fewer is faster and reaches the bands more often.
ราคาที่ใช้คำนวณ ค่าเริ่มต้น close ตัวอย่างนี้ใช้ close เสมอThe price it is computed from; close by default. The demo always uses close.
ระดับของแถบบนและล่าง ใช้ทั้งเส้นที่วาด การแรเงา และเกณฑ์ของมาร์กเกอร์ แถบบน 50 – 99 แถบล่าง 1 – 50The upper and lower band levels: the lines, the shading and the markers' thresholds alike; the upper takes 50 – 99, the lower 1 – 50.
Calculationช่องที่ TradingView เพิ่มให้Inputs TradingView adds2
ตัวอย่างนี้คำนวณบนไทม์เฟรมของกราฟเสมอThe demo always computes on the chart's timeframe.
คำนวณ RSI บนไทม์เฟรมนี้แล้วแสดงบนกราฟ เว้นว่างคือไทม์เฟรมของกราฟComputes the RSI on this timeframe and shows it on the chart; empty is the chart's own.
เปิด (ค่าเริ่มต้น ตามที่โค้ดตั้ง timeframe_gaps = true): ค่าของไทม์เฟรมที่สูงกว่าแสดงเมื่อแท่งนั้นปิดแล้วเท่านั้นOn (the default, as the code sets timeframe_gaps = true): a higher timeframe's value shows only once its bar has closed.
4ทดลองปรับค่าเองTry it
- แถบที่กว้างขึ้นWider bands
ตั้งแถบเป็น 80 / 20 แรเงาและมาร์กเกอร์จะเหลือเฉพาะช่วงที่สุดขั้วกว่าSet the bands to 80 / 20: the shading and markers keep only the more extreme stretches.
5จุดที่มักเข้าใจผิดCommon pitfalls
- ซื้อมากเกินไม่ได้แปลว่าต้องลงOverbought is not a sell
ในแนวโน้มแรง RSI อยู่เหนือแถบบนได้นาน แถบบอกตำแหน่งของโมเมนตัม ไม่ได้บอกจุดกลับตัวIn a strong trend RSI can stay above the upper band for long; the bands locate momentum, they do not call turns.
ส่วนที่ 2Part 2
มาร์กเกอร์ยอดและก้นPeak and trough markers
1โมดูลนี้คืออะไรWhat it is
ระหว่างที่ RSI อยู่ที่หรือเหนือแถบบน อินดิเคเตอร์จำค่าสูงสุดที่ทำได้ เมื่อ RSI หันลงครั้งแรก หลังค่าสูงสุดนั้น (แท่งก่อนหน้าอยู่ในโซน และแท่งนี้ต่ำกว่าแท่งก่อนหน้า) จะวาดสามเหลี่ยมแดงชี้ลงที่แท่งก่อนหน้า คือแท่งที่เป็นยอด สูงกว่าค่า RSI ของแท่งนั้น 10 จุด ฝั่งล่างทำแบบเดียวกันกลับด้าน: ค่าต่ำสุดในโซนที่หรือใต้แถบล่าง แล้วหันขึ้นครั้งแรก ได้สามเหลี่ยมเขียวชี้ขึ้นใต้ก้น 10 จุดWhile RSI is at or above the upper band, the indicator keeps the highest value reached. On the first downturn after that high (the previous bar in the zone, this bar lower than it) a red triangle pointing down is drawn on the previous bar, the high itself, 10 points above its RSI. The lower side mirrors it: the lowest value at or below the lower band, then the first upturn, gives a green triangle pointing up 10 points under that low.
มาร์กเกอร์ไม่ได้รอให้ RSI ออกจากโซน แท่งที่หันอาจยังอยู่ในโซน และถ้า RSI ทำค่าสูงสุดใหม่ในโซนอีก การจำจะเริ่มใหม่ จึงอาจมีหลายสามเหลี่ยมในการเข้าโซนครั้งเดียว ทุกสามเหลี่ยมแสดงช้าไปหนึ่งแท่ง (ต้องเห็นแท่งที่หันก่อน) แล้ววาดย้อนไปที่ยอดหรือก้นA marker does not wait for RSI to leave the zone: the turning bar can still be inside it, and if RSI makes a new high in the zone the count starts again, so one visit can carry several triangles. Each appears one bar late (the turn has to be seen first) and is drawn back on the high or low.
2อ่านบนกราฟยังไงReading it on the chart
- ▼ แดง ยอดในโซนซื้อมากเกิน▼ red a high in the overbought zone
- ▲ เขียว ก้นในโซนขายมากเกิน▲ green a low in the oversold zone
3ปรับแล้วได้อะไรWhat each setting changes
เรียงตามหน้าตั้งค่าบน TradingView ปุ่มสีทองในแต่ละข้อจะเปลี่ยนค่าบนกราฟด้านบนให้ดูทันทีIn the order TradingView lists them. The gold buttons change the chart above so you can see the effect.
Marker Settingsมาร์กเกอร์Markers2
แสดงมาร์กเกอร์ยอดและก้นShows the peak and trough markers.
ขนาดสามเหลี่ยมTriangle size.
4ทดลองปรับค่าเองTry it
- โซนที่แคบลงNarrower zones
ตั้งแถบเป็น 80 / 20 แล้วดูว่ามาร์กเกอร์เหลือเท่าไรSet the bands to 80 / 20 and see how many markers remain.
5จุดที่มักเข้าใจผิดCommon pitfalls
- ยอดในโซนอาจมีหลายอันOne zone visit, several peaks
ทุกครั้งที่ RSI ทำค่าสูงสุดใหม่ในโซนแล้วหันลง จะได้มาร์กเกอร์ใหม่ มาร์กเกอร์จึงไม่ใช่ยอดของทั้งช่วงที่อยู่ในโซนเสมอไปEach time RSI makes a new high in the zone and turns down, a new marker prints, so a marker is not always the top of the whole visit.
- มาร์กเกอร์ไม่ใช่จุดกลับตัวA marker is not a reversal
บอกแค่ว่า RSI หันจากค่าสุดขั้วในโซน ให้อ่านคู่กับการเคลื่อนที่ของราคาIt only says RSI turned from an extreme in the zone; read it with price action.
ส่วนที่ 3Part 3
เส้นเฉลี่ยของ RSIThe RSI average
1โมดูลนี้คืออะไรWhat it is
เส้นเฉลี่ยของ RSI (สีเหลือง) ทำให้เส้นเรียบขึ้น ค่าเริ่มต้นเป็น SMA 14 เลือกได้ SMA, EMA, SMMA (RMA), WMA, VWMA หรือ None เพื่อซ่อน แบบ SMA + Bollinger Bands เพิ่มแถบเขียวเหนือและใต้ SMA ห่างตาม BB StdDev (ค่าเริ่มต้น 2) เท่าของส่วนเบี่ยงเบนมาตรฐานของ RSI บอกว่า RSI ยืดออกจากค่าเฉลี่ยของตัวเองแค่ไหนAn average of the RSI (yellow) smooths the line; SMA 14 by default, with SMA, EMA, SMMA (RMA), WMA, VWMA, or None to hide it. SMA + Bollinger Bands adds green bands above and below the SMA, BB StdDev (2 by default) standard deviations of the RSI away, showing how far RSI stretches from its own average.
2อ่านบนกราฟยังไงReading it on the chart
- เส้นเฉลี่ย สีเหลืองThe average yellow
- ไม่แสดงตามค่าเริ่มต้น Bollinger Bands (เลือก SMA + Bollinger Bands)Not shown by default: Bollinger Bands (pick SMA + Bollinger Bands)
3ปรับแล้วได้อะไรWhat each setting changes
เรียงตามหน้าตั้งค่าบน TradingView ปุ่มสีทองในแต่ละข้อจะเปลี่ยนค่าบนกราฟด้านบนให้ดูทันทีIn the order TradingView lists them. The gold buttons change the chart above so you can see the effect.
Smoothingเส้นเฉลี่ยThe average3
ชนิดของเส้นเฉลี่ย None ซ่อนเส้น SMA + Bollinger Bands ใช้ SMA พร้อมแถบThe average's type; None hides it, SMA + Bollinger Bands is an SMA with bands.
ความยาวของเส้นเฉลี่ยและของส่วนเบี่ยงเบนมาตรฐานที่ใช้กับแถบLength of the average, and of the deviation the bands use.
ใช้เมื่อเลือก SMA + Bollinger Bands เท่านั้น ระยะห่างของแถบจาก SMA เป็นจำนวนเท่าของส่วนเบี่ยงเบนมาตรฐานOnly with SMA + Bollinger Bands: the bands' distance from the SMA, in standard deviations.
4ทดลองปรับค่าเองTry it
- RSI ยืดแค่ไหนHow stretched RSI is
เลือก SMA + Bollinger Bands แล้วดูว่า RSI ออกนอกแถบบ่อยแค่ไหนPick SMA + Bollinger Bands and see how often RSI leaves them.
5จุดที่มักเข้าใจผิดCommon pitfalls
- เส้นเฉลี่ยไม่มี alertThe average has no alert
โค้ดไม่มี alert สำหรับการตัดเส้นเฉลี่ยหรือแถบThe code has no alert for crossing the average or the bands.
ส่วนที่ 4Part 4
Divergence
1โมดูลนี้คืออะไรWhat it is
เปิด Calculate Divergence (ปิดไว้ตามค่าเริ่มต้น) เพื่อหาไดเวอร์เจนซ์แบบปกติ ขาขึ้น: ราคาทำ Low ต่ำลงแต่ RSI ทำก้นสูงขึ้น ขาลง: ราคาทำ High สูงขึ้นแต่ RSI ทำยอดต่ำลง ทั้งสองบอกว่าโมเมนตัมตามราคาไม่ทัน จุดกลับตัวของ RSI ใช้แท่งก่อนหน้าและหลังอย่างละ 5 แท่ง และสองจุดต้องห่างกัน 5 – 60 แท่ง ค่าเหล่านี้เป็นค่าคงที่ในโค้ด ไม่มีในแท็บ Inputs ไม่มีไดเวอร์เจนซ์แบบซ่อนSwitch on Calculate Divergence (off by default) to find regular divergence. Bullish: price makes a lower Low while RSI makes a higher trough. Bearish: price makes a higher High while RSI makes a lower peak. Both show momentum not keeping up with price. RSI turns use 5 bars on each side and two turns must be 5 – 60 bars apart; these are constants in the code, not inputs. There is no hidden divergence.
จุดกลับตัวรู้ได้หลังแท่งด้านขวา 5 แท่งปิดครบ ไดเวอร์เจนซ์จึงปรากฏช้า 5 แท่ง และวาดย้อนกลับไปที่จุดกลับตัว เส้นเชื่อมจุดกลับตัวก่อนหน้ากับจุดใหม่ในหน้าต่าง RSI พร้อมป้าย Bull (เขียว ใต้ก้น) หรือ Bear (แดง เหนือยอด)A turn is known only once the 5 bars to its right have closed, so a divergence appears 5 bars late and is drawn back at the turn. A line joins the previous turn to the new one in the RSI pane, with a Bull tag (green, under the trough) or a Bear tag (red, over the peak).
2อ่านบนกราฟยังไงReading it on the chart
- Bull ไดเวอร์เจนซ์ขาขึ้น Bear ไดเวอร์เจนซ์ขาลงBull bullish divergence, Bear bearish divergence
- กราฟนี้เปิด Calculate Divergence ไว้ให้ (เฉพาะการ์ดนี้)This card has Calculate Divergence on (this card only).
3ปรับแล้วได้อะไรWhat each setting changes
เรียงตามหน้าตั้งค่าบน TradingView ปุ่มสีทองในแต่ละข้อจะเปลี่ยนค่าบนกราฟด้านบนให้ดูทันทีIn the order TradingView lists them. The gold buttons change the chart above so you can see the effect.
RSI SettingsDivergence1
เปิดการหาไดเวอร์เจนซ์ ต้องเปิดไว้ alert ของไดเวอร์เจนซ์จึงจะส่งได้Switches the divergence search on; it must be on for the divergence alerts to fire.
4ทดลองปรับค่าเองTry it
- ไดเวอร์เจนซ์กับความยาว RSIDivergence and the RSI length
ตั้ง RSI Length เป็น 21 จุดกลับตัวน้อยลงและไดเวอร์เจนซ์เปลี่ยนSet RSI Length to 21: fewer turns, different divergences.
5จุดที่มักเข้าใจผิดCommon pitfalls
- ไม่มีไดเวอร์เจนซ์บนกราฟNo divergence on the chart
Calculate Divergence ปิดไว้ตามค่าเริ่มต้นCalculate Divergence is off by default.
- ไดเวอร์เจนซ์มาช้า 5 แท่งA divergence arrives 5 bars late
ต้องรอแท่งด้านขวาของจุดกลับตัวครบ 5 แท่งThe 5 bars to the right of the turn have to close first.
ส่วนที่ 5Part 5
Alerts
โค้ดมี alert แบบ alertcondition() สองตัว และไม่มี alert() บน TradingView เลือกได้ในหน้าต่างสร้าง alert: Condition เป็นอินดิเคเตอร์นี้ แล้วเลือก Regular Bullish Divergence หรือ Regular Bearish Divergence สร้างแยกกันตัวละหนึ่ง alert ต้องเปิด Calculate Divergence ไว้ ถ้าปิด เงื่อนไขไม่มีทางเป็นจริงThe code has two alertcondition() entries and no alert(). On TradingView, pick them in the create-alert dialog: Condition set to this indicator, then Regular Bullish Divergence or Regular Bearish Divergence, one alert each. Calculate Divergence must be on; off, the conditions can never be true.
ข้อความตั้งไว้ตายตัวในโค้ด: Found a new Regular Bullish Divergence, `Pivot Lookback Right` number of bars to the left of the current bar. (และแบบ Bearish) คำว่า `Pivot Lookback Right` เป็นข้อความตรงตัว ไม่ได้ถูกแทนด้วยตัวเลข ส่งที่แท่งที่จุดกลับตัวยืนยัน คือ 5 แท่งหลังจุดกลับตัวThe message is fixed in the code: Found a new Regular Bullish Divergence, `Pivot Lookback Right` number of bars to the left of the current bar. (and the Bearish one). `Pivot Lookback Right` is literal text, not replaced by a number. It fires on the bar the turn confirms, 5 bars after the turn.
แม้ชื่อจะเป็น RSI Cross Alert แต่โค้ดนี้ไม่มี alert สำหรับมาร์กเกอร์ยอดและก้น การตัดแถบ หรือการตัดเส้นเฉลี่ย บน TradingView ยังสร้าง alert จากค่าของเส้นที่วาด เช่น RSI ตัดค่าที่กำหนด ได้จากหน้าต่าง alert ของ TradingView เองDespite the name RSI Cross Alert, this code has no alert for the peak and trough markers, band crosses or average crosses. On TradingView you can still build an alert from the plotted values, such as RSI crossing a value, in TradingView’s own alert dialog.
- จุดสีส้มเหนือแท่งราคาคือแท่งที่เงื่อนไขไดเวอร์เจนซ์เป็นจริง บันทึกใต้กราฟแสดงชื่อเงื่อนไขและข้อความAn orange dot over a price bar marks where a divergence condition is true; the log shows the condition and its message.
อ้างอิงReference
การตั้งค่าทั้งหมดAll settings
ทุกช่องตั้งค่าของโค้ด เรียงตามหน้าตั้งค่าบน TradingView ช่องที่มีจุดทอง เปลี่ยนแล้วกราฟเปลี่ยนตาม กด (i) เพื่ออ่านคำอธิบายของช่องนั้นEvery input of the code, in the order TradingView shows them. Inputs with a gold dot change the chart; press (i) for an input’s description.