OPEN-SOURCE SCRIPT

SMA Crossover with 1% SL/TP

Actualizado
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 percentage 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 1% above and below the entry price.
For a long position, the stop loss is set 1% below the entry price, and the take profit is set 1% above. For a short position, the stop loss is set 1% above the entry price, and the take profit is set 1% below.

The percentage-based approach ensures that the stop and target levels scale with the price, offering a flexible 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.
Notas de prensa
Converted to Pine Script V6
educational

Script de código abierto

Siguiendo fielmente el espíritu de TradingView, el autor de este script lo ha publicado en código abierto, permitiendo que otros traders puedan entenderlo y verificarlo. ¡Olé por el autor! Puede utilizarlo de forma gratuita, pero tenga en cuenta que la reutilización de este código en la publicación se rige por las Normas internas. Puede añadir este script a sus favoritos y usarlo en un gráfico.

¿Quiere utilizar este script en un gráfico?


También en:

Exención de responsabilidad