Price_Deviation Oleg — Strategy by olegask68

By olegask68

Performance Metrics

Description

📘 DescriptionThis script is an extended and customized version of the original work by the respected author fullmax.I adapted the logic for my own trading needs and added several improvements, including lot‑precision rounding to prevent exchange errors when using webhook automation, as well as additional visualization elements for clarity.🔧 Key EnhancementsLot precision control (prevents invalid quantity errors on exchanges when using webhooks)Base order labels for easier visual trackingMini‑table with live position metricsConfigurable date‑range window for backtestingDynamic safety‑order price calculationTrailing take‑profit optionImproved visualization of thresholds, MA, and TP levels🎯 How the Strategy WorksThe script calculates a moving average and compares the current price deviation against user‑defined thresholds.When the deviation condition is met, the strategy opens a base position and then manages it using safety orders that scale in both volume and distance.After entering a position, the script manages exits using:a fixed take‑profit targetor an optional trailing take‑profitplus a breakeven reference lineand an auto‑close mechanism when the averaging cycle resetsAll order quantities are rounded according to the selected lot precision to ensure compatibility with exchange requirements when sending webhook‑based orders.⚙️ Features OverviewDeviation‑based entry logicSafety orders with volume and step scalingConfigurable date window for testingTrailing TP with adjustable distanceBreakeven visualizationMini‑table showing quantity, USD value, open trades, PnL, and equityClean and intuitive chart visualization📝 DisclaimerThis script is provided for educational purposes only.It does not constitute financial advice and does not guarantee profits.Always test strategies on historical data before using them in live trading.

Browse all 5,900+ TradingView Pine Script strategies

View on TradingView