อินดิเคเตอร์สำหรับ TradingView · แสดงในหน้าต่างของตัวเองTradingView indicator · draws in its own pane
Money Flow Index+ v1.1.0
Money Flow Index (MFI) ที่บอกสถานะของตัวเอง: เส้นเปลี่ยนสีเป็นขาขึ้น ขาลง หรือยังไม่ชัดเจน ตามตำแหน่งของ MFI เทียบกับแถบกลาง 45 – 55 และมีโมดูล Divergence ที่หาไดเวอร์เจนซ์จาก MFI เส้นเดียวกับที่วาด เส้นไดเวอร์เจนซ์จึงลงตรงจุดกลับตัวที่เห็นบนเส้นเสมอ คำนวณบนไทม์เฟรมอื่นได้ในกลุ่ม Calculation alert ทั้งหมดส่งผ่าน alert ตัวเดียว MFI ใช้ volume ถ้าสินทรัพย์ไม่มี volume อินดิเคเตอร์จะหยุดพร้อมข้อความแจ้ง กราฟทุกอันในหน้านี้เป็นกราฟจริงที่กดได้: ราคาอยู่ด้านบน หน้าต่างของ MFI อยู่ด้านล่าง เลื่อนเมาส์ไปบนแท่งไหน ค่าในหน้าต่างจะแสดงตามแท่งนั้น กด ตั้งค่า เพื่อเปิดแผงตั้งค่าแบบเดียวกับบน TradingViewA Money Flow Index (MFI) that states its own read: the line is coloured bull, bear or undecided by where MFI sits against the 45 – 55 middle band, plus a Divergence module found on the same MFI that is drawn, so every divergence line lands on a turn you can see. It can be computed on another timeframe in the Calculation group. Every alert goes through one alert. MFI uses volume: on a symbol without volume it stops with a message. Every chart on this page is live: price on top, the MFI 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
เส้นสถานะThe state line
1โมดูลนี้คืออะไรWhat it is
MFI วัดแรงซื้อขายจากทั้งราคาและ volume อยู่ระหว่าง 0 ถึง 100 อินดิเคเตอร์นี้ให้เส้นบอกสถานะเองจากตำแหน่งของค่าบนแท่งนั้น: เหนือ 55 เป็นขาขึ้น (เขียว) ใต้ 45 เป็นขาลง (แดง) และระหว่าง 45 – 55 เป็นยังไม่ชัดเจน (เทา) สีบอกว่า MFI อยู่ตรงไหน ไม่ใช่ว่ามาถึงอย่างไร ถอยกลับเข้าแถบกลางเมื่อไร แท่งนั้นก็เป็นสีเทาทันที ไม่มีการจำสถานะเดิมMFI measures buying and selling pressure from price and volume together, on a 0 to 100 scale. Here the line states its own read from where the value sits on that bar: above 55 is bull (green), below 45 is bear (red), and 45 – 55 is undecided (grey). The colour says where MFI is, not how it got there: fall back into the middle band and that bar turns grey at once. No state is carried over.
ค่าเริ่มต้น Length 7 ตั้งใจให้เร็ว ตอบสนองเร็วและแกว่งบ่อย ซึ่งแถบกลางมีไว้รับการแกว่งนั้น ขอบบนล่างจึงอยู่ที่ 90 / 10 แทน 80 / 20 แบบทั่วไป เพราะ MFI 7 แท่งแตะ 80 และ 20 บ่อยเกินกว่าจะมีความหมาย เมื่อ MFI ขึ้นเกิน 90 ช่วงที่เกินจะแรเงาแดง ลงต่ำกว่า 10 แรเงาเขียว ระดับ 90 / 55 / 45 / 10 และสีของสถานะเป็นค่าคงที่ในโค้ด ไม่มีในแท็บ Inputs เส้นระดับและพื้นทั้งสี่ปรับได้ในแท็บ Style แถบบรรทัดสถานะแสดง MFI และ LengthThe default Length of 7 is deliberately fast: it reacts early and whipsaws, which the middle band exists to absorb. So the extremes sit at 90 / 10 rather than the usual 80 / 20, because a 7-bar MFI tags 80 and 20 too often for them to mean much. Above 90 the overshoot is shaded red, below 10 green. The 90 / 55 / 45 / 10 levels and the state colours are constants in the code, not inputs; the level lines and the four fills are editable in the Style tab. The status line shows MFI and its Length.
2อ่านบนกราฟยังไงReading it on the chart
- เส้น MFI ขาขึ้น เหนือ 55 ขาลง ใต้ 45 ยังไม่ชัดเจนThe MFI line bull, above 55 bear, below 45 undecided
- แถบกลาง พื้นเทาระหว่าง 45 กับ 55 มีเส้นจุดที่ขอบ และเส้น 50 ตรงกลางThe middle band grey fill between 45 and 55, dotted at its edges, with the 50 line inside
- 90 / 10 เส้นประ แรเงาแดงเมื่อ MFI เกิน 90 เขียวเมื่อต่ำกว่า 1090 / 10: dashed lines; red shading while MFI is above 90, green below 10
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.
MFIเส้น MFIThe MFI2
จำนวนแท่งของ MFI ใช้ทั้งเส้นสถานะและการหาไดเวอร์เจนซ์ เพราะมีเส้นเดียว ถ้าไดเวอร์เจนซ์ถี่เกินไป ให้เพิ่ม Turn strength และ Bars between turns แทนการเพิ่มค่านี้ จะกรองจุดกลับตัวได้โดยไม่เปลี่ยนนิสัยของเส้นBars in the MFI; it drives both the state line and the divergence engine, since there is one line. If divergence comes too often, raise Turn strength and Bars between turns rather than this: that filters the turns without changing the line's character.
ราคาที่ใช้คำนวณ ค่าเริ่มต้น hlc3 (ค่าเฉลี่ยของ High, Low, Close) ตัวอย่างนี้ใช้ hlc3 เสมอThe price the MFI is computed from; hlc3 (the mean of High, Low and Close) by default. The demo always uses hlc3.
Calculationไทม์เฟรมที่คำนวณComputing timeframe2
ตัวอย่างนี้คำนวณบนไทม์เฟรมของกราฟเสมอ สองช่องนี้จึงไม่เปลี่ยนกราฟThe demo always computes on the chart's timeframe, so these two do not change the chart.
คำนวณทั้งอินดิเคเตอร์บนไทม์เฟรมอื่นแล้วแสดงบนกราฟนี้ ทั้งเส้นสถานะ ระดับ และไดเวอร์เจนซ์ตามไทม์เฟรมนั้น เว้นว่างคือใช้ไทม์เฟรมของกราฟ ควรเลือกไทม์เฟรมที่เท่ากับหรือสูงกว่ากราฟ โค้ดไม่ได้จัดการกรณีไทม์เฟรมต่ำกว่าเป็นพิเศษComputes the whole indicator on another timeframe and shows it on this chart: the state line, the levels and the divergence all follow it. Empty is the chart's own. Pick a timeframe at or above the chart's; the code has no special handling for a lower one.
เปิด: ใช้ค่าของไทม์เฟรมนั้นเมื่อแท่งปิดแล้วเท่านั้น ไม่ repaint เส้นคงที่แล้วขยับเป็นขั้นทุกครั้งที่แท่งของไทม์เฟรมนั้นปิด ปิด: แสดงแท่งที่ยังไม่ปิด ค่าเปลี่ยนระหว่างแท่ง และไดเวอร์เจนซ์ที่หาจากแท่งนั้นก็เปลี่ยนได้ เมื่อไทม์เฟรมเท่ากับกราฟ สองช่องนี้ไม่มีผลOn: a value from that timeframe is used only once its bar has closed; nothing repaints and the line steps as each of its bars completes. Off: the forming bar is shown, so the value moves within the bar, and so can a divergence found on it. With the chart's own timeframe, neither applies.
4ทดลองปรับค่าเองTry it
- เร็วหรือช้าFast or slow
ตั้ง Length 14 แล้ว 21 สีเทาจะน้อยลงและเส้นแกว่งน้อยลงSet Length to 14, then 21: fewer grey stretches and a calmer line.
5จุดที่มักเข้าใจผิดCommon pitfalls
- สีไม่ได้บอกทิศที่กำลังไปThe colour is not a direction of travel
เส้นสีเขียวที่กำลังลงแต่ยังเหนือ 55 ยังเป็นสีเขียว สีบอกตำแหน่ง ไม่ใช่ทิศA green line falling but still above 55 stays green: the colour is position, not direction.
- ปรับระดับใน Inputs ไม่ได้The levels are not inputs
90 / 55 / 45 / 10 เป็นค่าคงที่ในโค้ด แท็บ Style เปลี่ยนได้แค่สีและการแสดงของเส้นกับพื้น ไม่ได้เปลี่ยนเกณฑ์ของสถานะ90 / 55 / 45 / 10 are constants in the code; the Style tab changes how the lines and fills look, not the state thresholds.
- ไทม์เฟรมสูงกว่าทำให้เส้นเป็นขั้นA higher timeframe makes the line step
เมื่อคำนวณบนไทม์เฟรมที่สูงกว่าและเปิด Wait for timeframe closes ค่าจะคงที่ตลอดแท่งของไทม์เฟรมนั้น แล้วขยับทีเดียวเมื่อแท่งปิดComputed on a higher timeframe with Wait for timeframe closes on, the value holds through each of that timeframe's bars and moves once at its close.
ส่วนที่ 2Part 2
Divergence
1โมดูลนี้คืออะไรWhat it is
โมดูลนี้หาจุดกลับตัวของ MFI (ยอดและก้น) แล้วเทียบกับจุดกลับตัวก่อนหน้าชนิดเดียวกัน พร้อมราคาที่แท่งนั้น (Low ของแท่งก้น High ของแท่งยอด) Regular: ราคาทำจุดสุดใหม่แต่กระแสเงินไม่ทำตาม อ่านเป็นแรงที่จางลงระหว่างการวิ่ง Hidden: ราคารักษาโครงสร้างแนวโน้ม ขณะที่กระแสเงินทำจุดสุดใหม่ อ่านเป็นการย่อที่ถูกดูดซับแล้วไปต่อ ค่าเริ่มต้นเปิดแค่ Regular ไดเวอร์เจนซ์หาจาก MFI เส้นที่วาดอยู่ เส้นไดเวอร์เจนซ์จึงลงที่จุดกลับตัวที่มองเห็นเสมอThis module finds MFI's turns (peaks and troughs) and compares each with the previous turn of the same kind, with price on that bar (the Low at a trough, the High at a peak). Regular: price makes a new extreme and money flow does not, participation fading into the move. Hidden: price holds its trend structure while money flow makes the new extreme, a pullback absorbed, a continuation read. Only Regular is on by default. Divergence is found on the MFI that is drawn, so every line lands on a turn you can see.
จุดกลับตัวต้องมีแท่งก่อนและหลังตามจำนวนที่ตั้ง (5 / 5) จึงรู้ได้หลังแท่ง after ปิดครบ ไดเวอร์เจนซ์จึงปรากฏช้ากว่าจุดกลับตัวเท่านั้น และวาดย้อนกลับไปที่จุดกลับตัว นี่คือวิธีหาจุดกลับตัว ไม่ใช่การ repaint สองจุดถูกเทียบเมื่อจำนวนแท่งระหว่างแท่งที่ยืนยันอยู่ในช่วง min / max (5 / 60) บน MFI ที่เร็ว Turn strength คือตัวคุมสัญญาณรบกวนหลักA turn needs the set bars before and after it (5 / 5), so it is known only once the after-bars have closed: a divergence appears that many bars after the turn and is drawn back at it. That is how turns are found, not repainting. Two turns are compared when the bars between their confirmations fall within min / max (5 / 60). On a fast MFI, Turn strength is the main noise control.
2อ่านบนกราฟยังไงReading it on the chart
- Bull เส้นและป้ายเขียวใต้ก้นของ MFI: ไดเวอร์เจนซ์ขาขึ้นแบบปกติBull a green line and tag under the MFI trough: regular bullish divergence
- Bear เส้นและป้ายแดงเหนือยอดของ MFI: ไดเวอร์เจนซ์ขาลงแบบปกติBear a red line and tag over the MFI peak: regular bearish divergence
- H สีเดียวกันแต่จางกว่า: แบบซ่อนH the same colours, paler: hidden
- ปิดไว้ตามค่าเริ่มต้น HiddenOff by default: Hidden
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.
Modulesสวิตช์ของโมดูลModule switches2
เปิดปิดโมดูล Divergence เส้นสถานะวาดเสมอSwitches the Divergence module; the state line is always drawn.
ซ่อนไดเวอร์เจนซ์บนไทม์เฟรมกราฟที่สูงกว่าค่านี้ ซ่อนการแสดงผลและ alert ไดเวอร์เจนซ์ การคำนวณยังทำงานHides the divergences above this chart timeframe: display and divergence alerts; the engine keeps running.
Divergenceชนิด จุดกลับตัว และการแสดงผลKinds, turns and display5
เลือกชนิดที่หา Regular (เปิด) และ Hidden (ปิด)Which kinds are found: Regular (on) and Hidden (off).
จำนวนแท่งที่ต้องอยู่ทั้งสองข้างของจุดกลับตัว เพิ่มทั้งคู่เพื่อเหลือแต่จุดกลับตัวที่เด่น ไดเวอร์เจนซ์ปรากฏช้ากว่าจุดกลับตัวเท่าจำนวน afterBars needed on each side of a turn; raise both to keep only the turns that stand out. A divergence appears this many after-bars late.
ระยะห่างของสองจุดกลับตัวที่จะเทียบ นับแท่งระหว่างแท่งที่ยืนยัน ถ้าป้ายเบียดกัน เพิ่มค่า min บน MFI เร็ว สองจุดห่างกันห้าแท่งมักเป็นสวิงเดียวกันHow far apart two turns may be, counted between their confirmations. If tags crowd each other raise the minimum: on a fast MFI two turns five bars apart are usually the same swing.
จำนวนไดเวอร์เจนซ์ล่าสุดที่เก็บไว้บนกราฟHow many of the latest divergences stay on the chart.
ขนาดตัวอักษรของป้าย Bull / Bear / HText size of the Bull / Bear / H tags.
4ทดลองปรับค่าเองTry it
- กรองจุดกลับตัวFilter the turns
ตั้ง before 8 จุดกลับตัวเล็ก ๆ หายไป ไดเวอร์เจนซ์น้อยลงSet Before to 8: the small turns drop out and there are fewer divergences.
5จุดที่มักเข้าใจผิดCommon pitfalls
- ไดเวอร์เจนซ์มาช้าA divergence arrives late
จุดกลับตัวรู้ได้หลังแท่ง after ปิดครบ เส้นจึงวาดย้อนหลัง และ alert ส่งตอนยืนยันA turn is known only after its after-bars close, so the line is drawn back at the turn and the alert fires at the confirmation.
- เปลี่ยน Length แล้วไดเวอร์เจนซ์เปลี่ยนหมดA new Length changes every divergence
ไดเวอร์เจนซ์หาจาก MFI เส้นเดียวกับเส้นสถานะ เปลี่ยน Length จึงเปลี่ยนทั้งสองอย่างDivergence comes from the same MFI as the state line, so a new Length changes both.
ส่วนที่ 3Part 3
Alerts
1โมดูลนี้คืออะไรWhat it is
สร้าง alert บน TradingView ตัวเดียว ตั้ง Condition เป็นอินดิเคเตอร์นี้ → Any alert() function call แล้วเลือกเหตุการณ์ในกลุ่ม Alerts · … ต้องเปิด Enable alerts ก่อน (ปิดไว้ตามค่าเริ่มต้น) และทุกเหตุการณ์ปิดไว้ตามค่าเริ่มต้นCreate one TradingView alert with Condition set to this indicator → Any alert() function call, then pick events in the Alerts · … groups. Enable alerts must be on first (off by default), and every event is off by default.
ทุกเหตุการณ์ที่ติ๊กไว้และเกิดในแท่งเดียวกัน มาในข้อความเดียว คั่นด้วย · ในรูปแบบ MFI+ · XAUUSD 5m — MFI turned bull @ 56.31 ตัวเลขหลัง @ คือค่า MFI ของแท่งนั้น (ไม่ใช่ราคา) ไทม์เฟรมเขียนพร้อมหน่วย (5m, 1h, 1D) alert ของไดเวอร์เจนซ์ตามการซ่อนของโมดูลด้วย ส่วน alert ของสถานะไม่ขึ้นกับโมดูลใดEvery ticked event raised on one bar arrives in one message, joined with ·, in the form MFI+ · XAUUSD 5m — MFI turned bull @ 56.31. The number after @ is that bar's MFI, not the price; the timeframe carries its unit (5m, 1h, 1D). Divergence alerts follow the module's visibility; state alerts belong to no module and always can fire.
2อ่านบนกราฟยังไงReading it on the chart
- จุดสีส้มเหนือแท่งราคาคือแท่งที่มี alert บันทึกใต้กราฟเป็นข้อความที่จะได้รับ กดเพื่อไปที่แท่งนั้นAn orange dot over a price bar marks an alert; the log under the chart shows the messages; press one to go to its bar.
- กราฟนี้เปิด Enable alerts ไว้ให้ (เฉพาะการ์ดนี้)This card has Enable alerts 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.
Alertsสวิตช์หลักMaster switch2
สวิตช์หลัก ปิดแล้วไม่มีเหตุการณ์ไหนส่งThe master switch; off, no event fires.
เปิด (ค่าเริ่มต้น): เหตุการณ์ต้องอยู่จนแท่งปิด ปิด: เหตุการณ์ส่งระหว่างแท่งได้และอาจหายไปก่อนแท่งปิด ทั้งเหตุการณ์ของสถานะและไดเวอร์เจนซ์ (จุดกลับตัวคำนวณรวมแท่งที่ยังไม่ปิดด้วย) ตัวอย่างนี้แสดงแบบแท่งปิดOn (default): an event must survive the bar close. Off: events can fire within the bar and vanish before it closes, state events and divergences alike (the turns are computed with the forming bar too). The demo shows close-confirmed events.
Alerts · DivergenceDivergence1
ส่งที่แท่งที่ไดเวอร์เจนซ์ยืนยัน ชนิดนั้นต้องเปิดในกลุ่ม Divergence ด้วย ข้อความ Regular bullish divergence และแบบอื่นในรูปเดียวกันFires on the bar a divergence confirms; the kind must be on in Divergence too. Message Regular bullish divergence and likewise for the others.
Alerts · StateสถานะState3
เส้นเปลี่ยนเป็นสีขาขึ้นหรือขาลง คือ MFI ไปอยู่เหนือ 55 หรือใต้ 45 จากสถานะอื่น ข้อความ MFI turned bull / MFI turned bearThe line changing to bull or bear: MFI now above 55 or below 45 from another state. Messages MFI turned bull / MFI turned bear.
MFI กลับเข้าแถบ 45 – 55 จากฝั่งใดก็ได้ อินดิเคเตอร์ถอนการอ่านทิศ ข้อความ MFI entered the undecided bandMFI coming back into 45 – 55 from either side: the indicator withdrawing its read. Message MFI entered the undecided band.
MFI ตัดขึ้นเหนือ 90 หรือตัดลงใต้ 10 ข้อความ MFI crossed into overbought / MFI crossed into oversoldMFI crossing above 90 or below 10. Messages MFI crossed into overbought / MFI crossed into oversold.
4ทดลองปรับค่าเองTry it
- สถานะเปลี่ยนบ่อยแค่ไหนHow often the state changes
เปิด Turned bull / bear แล้วนับรายการ จากนั้นเปลี่ยน Length เป็น 14 ในส่วนที่ 1 แล้วกลับมาดูSwitch Turned bull / bear on and count the entries; then set Length to 14 and look again.
5จุดที่มักเข้าใจผิดCommon pitfalls
- ตัวเลขหลัง @ ไม่ใช่ราคาThe number after @ is not a price
ข้อความของ MFI+ ลงท้ายด้วยค่า MFI ทศนิยมไม่เกินสองตำแหน่งMFI+ messages end with the MFI value, to at most two decimals.
- ติ๊กแล้วไม่มี alertTicked, but nothing arrives
ต้องเปิด Enable alerts และสร้าง alert แบบ Any alert() function call alert ไดเวอร์เจนซ์ต้องเปิดโมดูลและไม่ถูกซ่อนบนไทม์เฟรมนั้นEnable alerts must be on and an Any alert() function call alert must exist; divergence alerts also need the module on and not hidden on that timeframe.
อ้างอิงReference
การตั้งค่าทั้งหมดAll settings
ทุกช่องตั้งค่าของโค้ด v1.1.0 เรียงตามหน้าตั้งค่าบน TradingView ช่องที่มีจุดทอง เปลี่ยนแล้วกราฟเปลี่ยนตาม กด (i) เพื่ออ่านคำอธิบายของช่องนั้นEvery input of v1.1.0, in the order TradingView shows them. Inputs with a gold dot change the chart; press (i) for an input’s description.