OPEN-SOURCE SCRIPT

Dual TF Stochastic Strategy

97
Core Strategy Components:
Uses two Stochastic oscillators (Primary and Reference)
Both use 15-second timeframe (15S)
Primary Stochastic settings:
K Length: 12
K Smoothing: 12
D Length: 12
Reference Stochastic settings:
K Length: 12
K Smoothing: 15
D Length: 30
Entry Logic:
Long Entries occur when:
Primary %K crosses over %D
AND either:
Reference %D is ≥ 50 or < 20
OR Primary %K is close to Reference %D (within 0.15)
AND price is above Moving Average (if MA filter enabled)
AND during regular market hours (9:30 AM - 4:00 PM ET)
Short Entries occur when:
Primary %K crosses under %D
AND either:
Within tolerance of Reference %D
OR specific crossunder conditions met
AND price is below Moving Average
AND during regular market hours
Exit Logic:
Time-based exits:
At 3:30 PM ET
End of regular market hours
Technical exits:
Long positions: When Primary %K crosses under Reference %D
Short positions: When Primary %K crosses over Reference %D and Reference %D > 20
Pattern Detection:
Higher Low Pattern:
Current crossover %K > Previous crossover %K
Bullish continuation pattern
Lower High Pattern:
Current crossunder %K < Previous crossunder %K
Bearish continuation pattern
Risk Management:
Price difference filters:
Maximum price difference: 0.1%
Minimum price difference for shorts: 0.1%
Reference %D tolerance: 0.1%
Close %K tolerance: 0.7%
Strengths:
Multiple confirmation layers (dual timeframes, MA filter)
Clear entry/exit rules
Pattern recognition for trend continuation
Time-based filters to avoid volatile periods
Comprehensive alert system
Potential Limitations:
Short timeframe (15S) may generate more false signals
Tight price difference filters might miss some opportunities
Relies heavily on Reference %D levels
No stop-loss implementation visible in the code
Suggested Improvements:
Add stop-loss mechanisms
Implement position sizing rules
Add volume confirmation
Consider adding RSI or other momentum filters
Add backtesting statistics tracking
Best Use Cases:
Day trading in liquid markets
Markets with clear trends
Time periods with normal volatility
When price action aligns with Stochastic signals
Risk Considerations:
High-frequency trading due to 15S timeframe
Multiple entries possible in short timeframes
No explicit risk management beyond entry/exit rules
Market hours limitation might miss opportunities

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.