Configurable Reversal and Trend Trading with Scale-In Risk Controls
Summary
This script presents a configurable framework with reversal and trending modes. It builds a baseline from a selectable moving average, then places entry thresholds at a chosen distance measured with ATR, price standard deviation, or session VWAP standard deviation. The broader code includes options for trade direction, scaling into positions as price moves against them, profit and stop distances based on ATR, break-even trailing behavior, and a maximum dollar loss exit. It also includes optional trade-to-trade size adjustments and a time window intended for prop-firm rules.
The excerpt describes many controls but supplies no backtest results, market-specific evaluation, or evidence that the configurations work. Scaling into adverse moves and increasing order size after outcomes can raise exposure; quantity caps and loss exits are configurable safeguards, not proof of controlled risk. The source shown is truncated, so some signal and order details cannot be fully assessed. Treat it as an implementation example that requires code review and testing against realistic costs and execution assumptions.
Key ideas
- The script offers separate reversal and trend modes built around a moving-average or VWAP baseline.
- Entry bands can be scaled using ATR, price standard deviation, or session VWAP deviation.
- Positions can scale in as price moves adversely, with optional Heikin Ashi confirmation.
- Profit targets, protective stops, trailing behavior, dollar-loss limits, and quantity caps are configurable.
- Optional sizing rules adjust order quantities after wins or losses, but the document provides no validation of their performance.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.