OPEN-SOURCE SCRIPT
Diupdate

KON SET By Sai

"KON SET By Sai is a trend-following strategy that utilizes ATR-adjusted moving averages to determine entry and exit points. The strategy enters a long position when the price crosses above a custom moving average (adjusted by the ATR value) and exits at a defined target or stop-loss based on the ATR. Additionally, it incorporates re-entry logic, allowing the strategy to re-enter when the price reverses back to the entry point. This strategy is suitable for trend traders who want to manage risk with dynamically calculated stop-loss and target levels."

Tags:
Trend-following
ATR-based strategy
Entry and exit strategy
Stop-loss and target
Re-entry logic
Pine Script strategy
Algorithmic trading
Example Use Case:
"This strategy can be used to trade in trending markets. It provides clear entry and exit signals with automated risk management, making it ideal for traders who prefer systematic approaches to trade management. It works best on lower timeframes (like 5min) for capturing medium-term trends."

How It Works:
Entry Point: The strategy enters a long position when the price crosses above an ATR-adjusted moving average (set by the user).
Exit Points:
Stop-loss is set dynamically based on the ATR value.
Target is also based on the ATR, with an additional multiplier for customization.
Re-entry Logic: If the price retraces back to the entry level, the strategy re-enters the position.
Exit Conditions: The strategy exits when the price hits the stop-loss or target price.
Example:
If the current ATR is 2.0, the strategy will:

Stop-loss: 2x ATR below the entry price.
Target: 5 + user-defined multiplier x ATR above the entry price.
Catatan Rilis
Pine Script Strategy: KON SET By Sai:
Overview:
This Pine Script strategy, KON SET By Sai, is designed for trend-based trading. It detects entry points based on price crossovers with a smoothed moving average, sets dynamic stop-loss and target prices using ATR, and includes a re-entry mechanism when the price retraces within a buffer zone.

Key Features:
✅ Trend-Based Entry – Uses moving averages and ATR to detect trend shifts.
✅ ATR-Based Stop-Loss & Target – Dynamically adjusts risk levels.
✅ Re-Entry Mechanism – Allows new entries when price revisits the entry zone.
✅ Visual & Alert System – Displays key levels and sends alerts on signals.

Strategy Logic
1️⃣ Entry Conditions
A long trade is initiated when the closing price crosses above a dynamically calculated resistance level (sma_high).

Entry price: close price at signal.
Stop-loss: 2x ATR below entry.
Target: 5x ATR + user-defined multiplier above entry.
pinescript
Copy
Edit
signal_up = ta.crossover(close, sma_high)
if not inTrade and signal_up
entryPrice := close
stopLoss := close - atr_value * 2
targetPrice := close + atr_value * (5 + target_multiplier)
strategy.entry("Long", strategy.long)
strategy.exit("Exit Long", "Long", stop=stopLoss, limit=targetPrice)
📌 Alerts:
Sends an entry alert with price details when a trade is triggered.

2️⃣ Trade Exit Conditions
The position closes when:
✔ Price reaches the target
✔ Price hits the stop-loss

pinescript
Copy
Edit
if inTrade and (close <= stopLoss or close >= targetPrice)
inTrade := false
entryPrice := na
stopLoss := na
targetPrice := na
Labels and lines are cleared to avoid clutter.

3️⃣ Re-Entry Mechanism
If a trade closes and price retraces within a buffer range, a new entry is triggered.

The re-entry buffer is ATR-based to avoid false signals.
Ensures only one re-entry per signal to prevent overtrading.
pinescript
Copy
Edit
if not inTrade and close >= lastEntryPrice - re_entry_buffer and close <= lastEntryPrice + re_entry_buffer
entryPrice := close
stopLoss := close - atr_value * 2
targetPrice := close + atr_value * (5 + target_multiplier)
strategy.entry("Re-Long", strategy.long)
strategy.exit("Re-Exit Long", "Re-Long", stop=stopLoss, limit=targetPrice)
lastEntryPrice := na
📌 Alerts:
Sends a re-entry alert when a new position is taken.

Visual Enhancements
🟢 Entry Labels – Marks trade entries on the chart.
🔴 Stop-Loss Labels – Displays stop-loss levels.
🔵 Target Labels – Highlights target points.

pinescript
Copy
Edit
entryLabel := label.new(bar_index, entryPrice, text="Entry: " + str.tostring(entryPrice, "#.##"), color=color.green)
slLabel := label.new(bar_index, stopLoss, text="Stop Loss: " + str.tostring(stopLoss, "#.##"), color=color.red)
targetLabel := label.new(bar_index, targetPrice, text="Target: " + str.tostring(targetPrice, "#.##"), color=color.blue)
📌 Background Zones:

Green: Active trade within entry & target range.
Red: Stop-loss risk area.
Customization Options
Users can adjust:
✅ ATR Length & Smoothing (for volatility-based stop-loss & targets).
✅ Trend Length (for moving average sensitivity).
✅ Target Multiplier (to fine-tune profit-taking).
✅ Re-Entry Buffer (to control re-entry conditions).

pinescript
Copy
Edit
length = input.int(10, "Trend Length")
target_multiplier = input.int(0, "Target Multiplier")
atr_length = input.int(200, "ATR Length")
atr_smoothing = input.int(200, "ATR Smoothing")
re_entry_buffer_multiplier = input.float(0.5, "Re-entry Buffer Multiplier")
Conclusion
🛠 KON SET By Sai is a trend-following strategy with an adaptive risk-reward system.
✅ Ideal for volatile markets with clear trends.
✅ Works well with multiple assets (Forex, Stocks, Crypto).
✅ Customizable parameters for flexible trading styles.

📌 How to Use:
1️⃣ Backtest on different assets & timeframes.
2️⃣ Fine-tune parameters for better performance.
3️⃣ Use alerts for live monitoring.

Pernyataan Penyangkalan