Yes, you can display the entry price, stop-loss, and target directly on the chart using plot().
For example, you can calculate the levels based on the strategy’s entry price:
//@version=6
strategy("Entry SL Target", overlay = true)
longCondition = ta.crossover(ta.ema(close, 9), ta.ema(close, 21))
if longCondition
strategy.entry("Long", strategy.long)
entryPrice = strategy.position_avg_price
stopLoss = entryPrice - 100
target = entryPrice + 200
plot(strategy.position_size > 0 ? entryPrice : na, "Entry", color = color.blue, linewidth = 2)
plot(strategy.position_size > 0 ? stopLoss : na, "Stop Loss", color = color.red, linewidth = 2)
plot(strategy.position_size > 0 ? target : na, "Target", color = color.green, linewidth = 2)
Here:
strategy.position_avg_price gives the average entry price.
stopLoss calculates the stop-loss level.
target calculates the target level.
plot() displays all three levels on the chart.
You can replace the fixed 100 and 200 values with your own SL and target calculation, such as a percentage, ATR-based distance, or risk-reward ratio.
This makes it much easier to visually track your entry, stop-loss, and target while the trade is active.