OPEN-SOURCE SCRIPT
Aggiornato BackToBasic XEMA

คำอธิบายการทำงานของอินดิเคเตอร์ "BackToBasic XEMA"
BackToBasic XEMA เป็นอินดิเคเตอร์ที่ใช้หลักการเปรียบเทียบ สองเส้นวิเคราะห์แนวโน้มราคาที่มีความไวต่างกัน
เมื่อเส้นที่ตอบสนองต่อราคาไวกว่า ตัดขึ้นเหนือเส้นที่ตอบสนองช้ากว่า → แสดงสัญญาณ Buy
ในทางกลับกัน หากตัดลงต่ำกว่า → แสดงสัญญาณ Sell
อินดิเคเตอร์นี้มีระบบพิเศษที่เรียกว่า เส้นติดตามผลอัตโนมัติ (Trail Line)
เมื่อราคาเคลื่อนไปในทิศทางที่ถูกต้องตามสัญญาณเกินระยะที่กำหนด (เช่น 2500 จุด)
จะมีเส้นแนวนอนลากตามระดับราคา เพื่อใช้เป็นแนวพิจารณาการปิดกำไรโดยอัตโนมัติ (หรือเชิงกลยุทธ์)
คุณสามารถปรับระยะห่างของสัญลักษณ์ Buy/Sell, เปิด/ปิดเส้นติดตาม และเลือกว่าจะใช้เส้นไหนเป็นฐานได้
🧠 HowBackToBasic XEMA Indicator Works
BackToBasic XEMA is an indicator based on comparing two trend-tracking lines with different sensitivities.
When the faster-reacting line crosses above the slower one → a Buy signal is shown.
Conversely, when it crosses below → a Sell signal appears.
It also features a dynamic horizontal trailing line, which only activates when the price has moved in the right direction by a certain amount (e.g., 2500 points).
This line extends horizontally from the latest calculated level and can be used as a reference for trailing stops or visual exit management.
Users can customize the symbol distance, toggle the trailing line, and choose which reference line to use for trailing.
BackToBasic XEMA เป็นอินดิเคเตอร์ที่ใช้หลักการเปรียบเทียบ สองเส้นวิเคราะห์แนวโน้มราคาที่มีความไวต่างกัน
เมื่อเส้นที่ตอบสนองต่อราคาไวกว่า ตัดขึ้นเหนือเส้นที่ตอบสนองช้ากว่า → แสดงสัญญาณ Buy
ในทางกลับกัน หากตัดลงต่ำกว่า → แสดงสัญญาณ Sell
อินดิเคเตอร์นี้มีระบบพิเศษที่เรียกว่า เส้นติดตามผลอัตโนมัติ (Trail Line)
เมื่อราคาเคลื่อนไปในทิศทางที่ถูกต้องตามสัญญาณเกินระยะที่กำหนด (เช่น 2500 จุด)
จะมีเส้นแนวนอนลากตามระดับราคา เพื่อใช้เป็นแนวพิจารณาการปิดกำไรโดยอัตโนมัติ (หรือเชิงกลยุทธ์)
คุณสามารถปรับระยะห่างของสัญลักษณ์ Buy/Sell, เปิด/ปิดเส้นติดตาม และเลือกว่าจะใช้เส้นไหนเป็นฐานได้
🧠 HowBackToBasic XEMA Indicator Works
BackToBasic XEMA is an indicator based on comparing two trend-tracking lines with different sensitivities.
When the faster-reacting line crosses above the slower one → a Buy signal is shown.
Conversely, when it crosses below → a Sell signal appears.
It also features a dynamic horizontal trailing line, which only activates when the price has moved in the right direction by a certain amount (e.g., 2500 points).
This line extends horizontally from the latest calculated level and can be used as a reference for trailing stops or visual exit management.
Users can customize the symbol distance, toggle the trailing line, and choose which reference line to use for trailing.
Note di rilascio
ไทย:– เพิ่มปุ่มเปิด/ปิดการแสดงเส้นและป้ายคำนวณกำไร–ขาดทุน
– ปรับสีและความหนาของเส้นกับสีข้อความของป้าย ได้ตามต้องการ
– เลือกขนาดข้อความบนป้าย (เล็ก–ใหญ่)
– แยกเปิด/ปิดและตั้งค่าสีของเส้น “Trailing Line” ได้อิสระ
– แก้โค้ดให้ใช้ตัวแปรสถานะ (var) และฟังก์ชันวาดเส้น/ป้าย (line.new, label.new) ถูกต้องตาม Pine v6
English:
– Added an on/off switch for drawing profit/loss lines & labels
– You can now pick line thickness and colors for both PnL and labels
– Allows choosing label text size (tiny to huge)
– Separate enable switch and color settings for the horizontal “Trailing Line”
– Updated variables and drawing calls (var, line.new, label.new) to match Pine Script v6 syntax
Note di rilascio
คำอธิบายการแก้ไข (ไทย):-คำนวณ PnL โดยใช้การเปลี่ยนแปลงราคาตรง ๆ ต่อสัญญา
-กำหนดจำนวนสัญญาที่ต้องการผ่าน input
-แสดงผลเป็นทศนิยม 2 ตำแหน่ง ตามตัวอย่าง 10 → 10.00$
-ตั้งค่าสีของข้อความ PnL ให้เป็นบวก/ลบตามกำไรหรือขาดทุน เพื่อให้เข้าใจง่าย
-ตรวจสอบและแก้ไขบัคที่อาจเกิดขึ้น ในการคำนวณหรือแสดงผล
Explanation of Fixes (English):
-Calculate PnL based on direct price change per contract
-Allow setting number of contracts via input
-Format output to 2 decimals, e.g., 10 → 10.00$
-Add color settings for PnL labels to indicate profit/loss more clearly
-Debugged the calculation and display issues to ensure accurate results
Script open-source
In pieno spirito TradingView, il creatore di questo script lo ha reso open-source, in modo che i trader possano esaminarlo e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricorda che la ripubblicazione del codice è soggetta al nostro Regolamento.
Declinazione di responsabilità
Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.
Script open-source
In pieno spirito TradingView, il creatore di questo script lo ha reso open-source, in modo che i trader possano esaminarlo e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricorda che la ripubblicazione del codice è soggetta al nostro Regolamento.
Declinazione di responsabilità
Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.