OPEN-SOURCE SCRIPT

Dynamic Stop Loss & Take Profit

Dynamic Stop Loss & Take Profit is a versatile risk management indicator that calculates dynamic stop loss and take profit levels based on the Average True Range (ATR). This indicator helps traders set adaptive exit points by using a configurable ATR multiplier and defining whether they are in a Long (Buy) or Short (Sell) trade.

How It Works
  1. ATR Calculation – The indicator calculates the ATR value over a user-defined period (default: 14).

  1. Stop Loss and Take Profit Multipliers – The ATR value is multiplied by a configurable factor (ranging from 1.5 to 4) to determine volatility-adjusted stop loss and take profit levels.

  1. Trade Type Selection – The user can specify whether they are in a Long (Buy) or Short (Sell) trade.


Long (Buy) Trade:
Stop Loss = Entry Price - (ATR × Stop Loss Multiplier)
Take Profit = Entry Price + (ATR × Take Profit Multiplier)

Short (Sell) Trade:
Stop Loss = Entry Price + (ATR × Stop Loss Multiplier)
Take Profit = Entry Price - (ATR × Take Profit Multiplier)

Features
  • Configurable ATR length and multipliers
  • Supports both long and short trades
  • Clearly plotted Stop Loss (red) and Take Profit (green) levels on the chart
  • Helps traders manage risk dynamically based on market volatility


This indicator is ideal for traders looking to set adaptive stop loss and take profit levels without relying on fixed price targets.

Declinazione di responsabilità