OPEN-SOURCE SCRIPT

Ultimate MA & PSAR [TARUN]

454
Overview
This indicator combines a customizable Moving Average (MA) and Parabolic SAR (PSAR) to generate precise long and short trade signals. A dashboard displays real-time trade conditions, including signal direction, entry price, stop loss, and PnL tracking.

Key Features
✅ Customizable MA Type & Period – Choose between SMA or EMA with adjustable length.
✅ Adaptive PSAR Settings – Modify start, increment, and max step values to fine-tune stop levels.
✅ Trade Signal Logic – Identifies potential buy (long) and sell (short) opportunities based on:
  • Price action relative to MA
  • MA trend direction (rising or falling)
  • PSAR confirmation

✅ Dynamic Stop Loss Calculation – Uses lowest low/highest high over a specified period for stop loss placement.
✅ Trade State & Reversal Handling – Manages active trades, pending signals, and stop loss exits dynamically.
✅ PnL & Dashboard Table – Displays real-time signal status, entry price, stop loss, and profit/loss (PnL) in an easy-to-read format.


How It Works

1.Buy (Long) Condition:
  • MA is rising
  • Price is above the MA
  • PSAR is below price


2.Sell (Short) Condition:
  • MA is falling
  • Price is below the MA
  • PSAR is above price


3.Stop Loss Handling:
  • For long trades → stop loss is set at the lowest low of the last X candles
  • For short trades → stop loss is set at the highest high of the last X candles


4.Trade Execution & PnL Calculation:
  • If a valid long/short setup is detected, a pending signal is placed.
  • On the next bullish (for long) or bearish (for short) candle, the trade is confirmed.
  • Real-time PnL updates help track trade performance.


Customization Options
🔹 Moving Average: SMA or EMA, adjustable period
🔹 PSAR Settings: Start, Increment, Maximum step values
🔹 Stop Loss Lookback: Choose how many candles to consider for stop loss placement
🔹 Dashboard Positioning: Select preferred display location (top/bottom, left/right)
🔹 Trade Signal Selection: Enable/Disable Long and Short signals individually


How to Use
  1. Add the indicator to your chart.
  2. Customize the MA & PSAR settings according to your trading strategy.
  3. Follow the dashboard signals for trade setups.
  4. Use stop loss levels to manage risk effectively.


Disclaimer
⚠️ This indicator is for educational purposes only and does not constitute financial advice. Always perform proper risk management and backtesting before using it in live trading.

免責聲明

這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。