OPEN-SOURCE SCRIPT

BackToBasic XEMA

104
บทความอธิบายสคริปต์ “BackToBasic XEMA”
ภาษาไทย
แนวคิดโดยย่อ
BackToBasic XEMA เกิดจากแนวคิด “กลับสู่พื้นฐานแต่เพิ่มประโยชน์” โดยใช้สัญญาณ EMA Crossover เป็นแกนหลัก แล้วต่อยอดด้วยการแสดงกำไร/ขาดทุนจริง (PnL) และเส้น Trailing Stop แนวนอน เพื่อช่วยวัดประสิทธิภาพและป้องกันการคืนกำไร

กลไกการทำงาน

Dual EMA – คำนวณ EMA สองเส้น (Fast และ Slow)

Crossover Signal – ออกสัญญาณ Buy เมื่อ Fast ตัดขึ้น Slow และ Sell เมื่อ Fast ตัดลง Slow

PnL Lines & Labels – เมื่อทิศทางกลับตัว ระบบจะคำนวณส่วนต่างราคา × จำนวน Contracts แล้ววาดเส้นเชื่อมจุดเข้า–ออก พร้อมป้ายกำไร/ขาดทุนสีเขียว / แดง

Horizontal Trailing Stop – เมื่อราคาวิ่งไปทางกำไรเกิน trailStartPips ระบบจะสร้างเส้น Trail ห่างจาก EMA อ้างอิงด้วย trailBufferPips และเลื่อนเฉพาะในทางที่ล็อกกำไร

การตั้งค่าใช้งาน (สรุปเป็นคำอธิบาย)

ปรับค่า Fast/Slow EMA ให้สัมพันธ์กับกรอบเวลาและความผันผวนของสินทรัพย์

กรอกจำนวน Contracts ตามขนาดโพซิชันจริงเพื่อให้ค่า PnL สมจริง

ค่า Trail เริ่มต้นเหมาะกับกราฟ 1 ชั่วโมงขึ้นไป หากเทรดสั้นอาจลด trailStartPips และ trailBufferPips

แนะนำใช้กับสินทรัพย์สภาพคล่องสูง (คู่เงินหลัก, XAUUSD, ดัชนี) และทดสอบบนบัญชีเดโมก่อนเสมอ

จุดเด่นเมื่อเทียบกับ EMA Crossover พื้นฐาน

เห็นผลกำไร/ขาดทุนของแต่ละการเทรดทันที ไม่ต้องคำนวณย้อนหลัง

มีเส้น Trailing Stop แนวนอนช่วยล็อกกำไรและจำกัดขาดทุน

เปิด–ปิดฟังก์ชัน PnL และ Trailing ได้จากหน้าตั้งค่า ไม่ยุ่งยาก

ข้อจำกัดและคำเตือน

ไม่เหมาะกับกราฟแบบ Heikin Ashi หรือ Renko เพราะอาจเกิด repaint

PnL คำนวณจากส่วนต่างราคาเท่านั้น ไม่รวมค่าคอมมิชชันหรือสลิปเพจ

ผลลัพธ์ในอดีตไม่รับประกันอนาคต ควรจัดการความเสี่ยงและทดลองก่อนใช้งานจริง

ลิขสิทธิ์
สคริปต์นี้พัฒนาใหม่ทั้งหมดโดย <CJSuperTrader>, © 2025

English
Concept
BackToBasic XEMA extends a classic EMA-crossover setup with real-time profit-and-loss tracking and a horizontal trailing-stop line, giving traders both clear entry/exit signals and built-in risk management.

How It Works

Dual EMAs – Calculates Fast and Slow EMAs.

Crossover Signals – Generates a Buy when the Fast EMA crosses above the Slow EMA, and a Sell when it crosses below.

PnL Lines & Labels – On every direction flip the script computes price difference × contracts, draws a line from entry to exit, and labels the result in green (profit) or red (loss).

Horizontal Trailing Stop – After price moves in profit by at least trailStartPips, a trail line is placed trailBufferPips away from the chosen EMA and moves only in the trade’s favour.

Practical Settings (plain-language guide)

Adjust Fast/Slow EMA lengths to suit your timeframe and the instrument’s volatility.

Enter your position size in Contracts so PnL lines reflect real cash values.

For shorter timeframes, lower trailStartPips and trailBufferPips; for swing trading, larger values work better.

Best used on 1-hour-and-above charts of liquid symbols (major FX pairs, gold, indices). Forward-test on demo first.

Advantages over a Basic EMA Cross

Instant visual feedback on each trade’s profit or loss.

Built-in horizontal trailing stop to lock in gains and limit downside.

Modular design – PnL and trailing features can be toggled on or off in the input panel.

Limitations & Disclaimer

Not repaint-safe on non-standard chart types such as Heikin Ashi or Renko.

PnL lines show raw price change only; commissions and slippage are not included.

Past performance does not guarantee future results – trade responsibly and test thoroughly.

License
Original Pine Script by <CJSuperTrader>, © 2025

Feragatname

Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, işlem veya diğer türden tavsiye veya tavsiyeler anlamına gelmez ve teşkil etmez. Kullanım Şartları'nda daha fazlasını okuyun.