OPEN-SOURCE SCRIPT

Improved Candle Strategy (without daily squared)

104
# Candle Pattern Trading Strategy

## Core Logic
Analyzes the last 5 candlesticks to identify "close at high" and "close at low" patterns, generating long/short signals.

## Trading Conditions
- **Long**: ≥2 bars closed at high in past 5 bars + current bar closes at high → Open long
- **Short**: ≥2 bars closed at low in past 5 bars + current bar closes at low → Open short
- **Filter**: If ≥3 doji patterns detected, skip trading

## Risk Management
- Stop Loss: Based on entry bar's high/low
- Take Profit: Risk × 2x multiplier
- Cooldown: No trading for 2 bars after entry
- Session Filter: No trading for first 5 bars after market open

## Configurable Parameters
- Lookback period, doji threshold, close proximity ratio, TP/SL ratio, cooldown bars, etc.

**Use Cases**: 1-minute and higher timeframes on stocks/futures

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.