// NNFX ATR Band Script
atrLength = 14
atrProfit = 1.5
atrLoss = 1
// Calculate ATR
atr = averagetruerange[atrLength]
// Buy Stop-Loss and Take-Profit Levels
bAtrBuy = close[1] + atr * atrProfit // Buy Take-Profit
bAtrSell = close[1] - atr * atrLoss // Buy Stop-Loss
// Sell Stop-Loss and Take-Profit Levels
sAtrBuy = close[1] - atr * atrProfit // Sell Take-Profit
sAtrSell = close[1] + atr * atrLoss // Sell Stop-Loss
// Example condition: Indicator crosses under
indicator1 = CALL "STIPH10"[1, 10] // use ma
condition = close CROSSES over indicator1
condition = close CROSSES under indicator1
// Draw horizontal lines only when the condition is met
if condition then
// Draw horizontal lines for Buy Stop-Loss and Take-Profit
drawsegment(barindex + 15, bAtrBuy, barindex, bAtrBuy) coloured(0, 0, 255) // Blue for Buy TP
drawsegment(barindex + 15, bAtrSell, barindex, bAtrSell) coloured(255, 0, 0) // Red for Buy SL
// Draw horizontal lines for Sell Stop-Loss and Take-Profit
drawsegment(barindex + 15, sAtrBuy, barindex, sAtrBuy) coloured(0, 0, 255) // Blue for Sell TP
drawsegment(barindex + 15, sAtrSell, barindex, sAtrSell) coloured(255, 0, 0) // Red for Sell SL
endif
// Return ATR for visualization/debugging
return