Q-Trend Entries with ATR Stops, Trailing Exits, and Date Filters
Summary
This Pine strategy builds a trend line from the highest and lowest source prices over a configurable lookback, then offsets its midpoint by an ATR-based buffer. A move across or beyond the buffered levels changes the trend state and can trigger a long or short entry. Users can choose between crossover-based and cross-based signal modes, optionally smooth the source with an EMA, and limit entries to a date window. The strategy closes the opposite side when a new signal arrives and can flatten any remaining position after the configured end date.
Risk controls are specified as ATR-based fixed and trailing exits, with the ATR read from the prior bar. The script uses a 200-period trend lookback, a 14-period ATR, and stated stop and trail multipliers as defaults. The surrounding description also mentions VIDYA and a two-pole oscillator as entry confirmation, but the shown strategy code does not implement those indicators. No instrument, backtest results, or performance evidence is provided, and execution behavior should be checked against the platform’s stop and trailing-order conventions.
Key ideas
- The trend line is based on a rolling high-low range midpoint adjusted by an ATR buffer.
- Price movement across buffered levels updates the signal state and can open long or short positions.
- Signal mode, source smoothing, and a date window are configurable.
- The script defines ATR-scaled fixed and trailing exits and can close positions after the end date.
- The description mentions additional confirmation indicators that are absent from the displayed code, and no results are supplied.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.