OPEN-SOURCE SCRIPT
Ultimate MA & PSAR [TARUN]

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:
How It Works
1.Buy (Long) Condition:
2.Sell (Short) Condition:
3.Stop Loss Handling:
4.Trade Execution & PnL Calculation:
Customization Options
How to Use
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.
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
- Add the indicator to your chart.
- Customize the MA & PSAR settings according to your trading strategy.
- Follow the dashboard signals for trade setups.
- 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的真正精神,此腳本的創建者將其開源,以便交易者可以查看和驗證其功能。向作者致敬!雖然您可以免費使用它,但請記住,重新發佈程式碼必須遵守我們的網站規則。
免責聲明
這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。
開源腳本
本著TradingView的真正精神,此腳本的創建者將其開源,以便交易者可以查看和驗證其功能。向作者致敬!雖然您可以免費使用它,但請記住,重新發佈程式碼必須遵守我們的網站規則。
免責聲明
這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。