OPEN-SOURCE SCRIPT
Adaptive Fractal Grid Scalping Strategy

This Pine Script v6 component implements an "Adaptive Fractal Grid Scalping Strategy" with an added volatility threshold feature.
Here's how it works:
How to Use
This strategy is designed to capitalize on micro-movements during high volatility and avoid overtrading during low-volatility trends. Adjust the input parameters to suit your trading style and market conditions.
Here's how it works:
- Fractal Break Detection: Uses ta.pivothigh and ta.pivotlow to identify local highs and lows.
- Volatility Clustering: Measures volatility using the Average True Range (ATR).
- Adaptive Grid Levels: Dynamically adjusts grid levels based on ATR and user-defined multipliers.
- Directional Bias Filter: Uses a Simple Moving Average (SMA) to determine trend direction.
- Volatility Threshold: Introduces a new input to specify a minimum ATR value required to activate the strategy.
- Trade Execution Logic: Places limit orders at grid levels based on trend direction and fractal levels, but only when ATR exceeds the volatility threshold.
- Profit-Taking and Stop-Loss: Implements profit-taking at grid levels and a trailing stop-loss based on ATR.
How to Use
- Inputs: Customize the ATR length, SMA length, grid multipliers, trailing stop multiplier, and volatility threshold through the input settings.
- Visuals: The script plots fractal points and grid levels on the chart for easy visualization.
- Trade Signals: The strategy automatically places buy/sell orders based on the detected fractals, trend direction, and volatility threshold.
- Profit and Risk Management: The script includes logic for taking profits and setting stop-loss levels to manage trades effectively.
This strategy is designed to capitalize on micro-movements during high volatility and avoid overtrading during low-volatility trends. Adjust the input parameters to suit your trading style and market conditions.
Script de código aberto
No verdadeiro espirito do TradingView, o autor desse script o publicou como código aberto, para que os traders possam entendê-lo e verificá-lo. Parabéns ao autor Você pode usá-lo gratuitamente, mas a reutilização desse código em publicações e regida pelas Regras da Casa.
Para acesso rápido no gráfico, adicione esse script para seus favoritos — saiba mais aqui.
Aviso legal
As informações e publicações não devem ser e não constituem conselhos ou recomendações financeiras, de investimento, de negociação ou de qualquer outro tipo, fornecidas ou endossadas pela TradingView. Leia mais em Termos de uso.
Script de código aberto
No verdadeiro espirito do TradingView, o autor desse script o publicou como código aberto, para que os traders possam entendê-lo e verificá-lo. Parabéns ao autor Você pode usá-lo gratuitamente, mas a reutilização desse código em publicações e regida pelas Regras da Casa.
Para acesso rápido no gráfico, adicione esse script para seus favoritos — saiba mais aqui.
Aviso legal
As informações e publicações não devem ser e não constituem conselhos ou recomendações financeiras, de investimento, de negociação ou de qualquer outro tipo, fornecidas ou endossadas pela TradingView. Leia mais em Termos de uso.