OPEN-SOURCE SCRIPT
Cập nhật XT SMA Crossover with 50 Tick SL/TP

This Pine Script strategy is built around a simple moving average (SMA) crossover and is an educational resource to illustrate how to write the NinjaTrader compatible message payload into your strategy.
This script specifically shows how to establish tick based stops and targets, which can then be passed through the {{strategy.action.alert_message}} variable.
Entry Condition:
A buy order is triggered when the 1-period SMA crosses above the 3-period SMA.
A sell order is triggered when the 1-period SMA crosses below the 3-period SMA.
Stop Loss and Take Profit:
The stop loss and take profit levels are calculated as 50 ticks above and below the entry price.
For a long position, the stop loss is set 50 ticks below the entry price, and the take profit is set 50 ticks above. For a short position, the stop loss is set 50 ticks above the entry price, and the take profit is set 50 ticks below.
The tick-based approach ensures that the stop and target levels are fixed offsets from the underlying price, offering a static risk management solution. Feel free to modify this script as you see fit and don't forget to add your secret key for the alerts to pass through CrossTrade.
This script specifically shows how to establish tick based stops and targets, which can then be passed through the {{strategy.action.alert_message}} variable.
Entry Condition:
A buy order is triggered when the 1-period SMA crosses above the 3-period SMA.
A sell order is triggered when the 1-period SMA crosses below the 3-period SMA.
Stop Loss and Take Profit:
The stop loss and take profit levels are calculated as 50 ticks above and below the entry price.
For a long position, the stop loss is set 50 ticks below the entry price, and the take profit is set 50 ticks above. For a short position, the stop loss is set 50 ticks above the entry price, and the take profit is set 50 ticks below.
The tick-based approach ensures that the stop and target levels are fixed offsets from the underlying price, offering a static risk management solution. Feel free to modify this script as you see fit and don't forget to add your secret key for the alerts to pass through CrossTrade.
Phát hành các Ghi chú
Updated to Pine Script V6Phát hành các Ghi chú
- Swapped the NT8 instrument format for the Pine Script {{ticker}} variable now that CrossTrade supports continuous contracts and will automatically convert the ticker into NT8s format.Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.