
This strategy is a comprehensive trading system based on the Parabolic SAR (Stop and Reverse) indicator, making buy and sell decisions through dynamic price trend tracking. The system adopts a classical trend-following method, combining both long and short trading mechanisms to capture price movements in different market conditions. The core of the strategy lies in using SAR indicator crossovers with price to identify trend reversal points and execute position operations at appropriate times.
The strategy operates based on the following core principles: 1. Uses the Parabolic SAR indicator as the primary trend determination tool, which dynamically adjusts its position according to price movements. 2. When the SAR indicator crosses under the price, the system identifies the beginning of an upward trend and triggers a long signal. 3. When the SAR indicator crosses over the price, the system identifies the beginning of a downward trend and triggers a short signal. 4. The strategy controls the SAR indicator’s sensitivity through three key parameters: starting value (0.02), step increment (0.02), and maximum value (0.2). 5. The system automatically plots SAR points on the chart, displayed in green during uptrends and red during downtrends.
This is a complete trading strategy based on classic technical indicators, characterized by systematic and objective features. Through appropriate parameter settings and strategy optimization, this system can achieve good performance in trending markets. However, users need to fully recognize the strategy’s limitations, especially its potentially suboptimal performance in choppy markets. It is recommended to conduct thorough backtesting and parameter optimization before live implementation, combined with appropriate risk management measures.
/*backtest
start: 2019-12-23 08:00:00
end: 2024-11-25 08:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("LTJ Strategy", overlay=true)
// Parámetros del Parabolic SAR
start = input(0.02, title="Start")
increment = input(0.02, title="Increment")
maximum = input(0.2, title="Maximum")
// Calculando el Parabolic SAR
sar = ta.sar(start, increment, maximum)
// Condiciones para entrar y salir de la posición
longCondition = ta.crossunder(sar, close) // Compra cuando el Parabolic SAR cruza por debajo del precio de cierre
exitLongCondition = ta.crossover(sar, close) // Venta cuando el Parabolic SAR cruza por encima del precio de cierre
// Condiciones para entrar y salir de la posición
shortCondition = ta.crossover(sar, close) // Compra cuando el Parabolic SAR cruza por debajo del precio de cierre
exitShortCondition = ta.crossunder(sar, close) // Venta cuando el Parabolic SAR cruza por encima del precio de cierre
// Ejecutando las órdenes según las condiciones
if (longCondition)
strategy.entry("Buy", strategy.long)
if (exitLongCondition)
strategy.close("Buy")
// Ejecutar las órdenes de venta en corto
if (shortCondition)
strategy.entry("Sell", strategy.short)
if (exitShortCondition)
strategy.close("Sell")
// Opcional: Dibujar el Parabolic SAR en el gráfico para visualización
// Si el SAR está por debajo del precio, lo pintamos de verde; si está por encima, de rojo
colorSar = sar < close ? color.green : color.red
plot(sar, style=plot.style_circles, color=colorSar, linewidth=2, title="Parabolic SAR")