-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.cursorrules
More file actions
49 lines (39 loc) · 1.89 KB
/
.cursorrules
File metadata and controls
49 lines (39 loc) · 1.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# Cursor Rules for Pine Script Development
## Context
This project contains Smart Money Concepts (SMC) / ICT trading indicators and strategies in Pine Script v6.
## Key Files
- Templates: templates/pinescript/ - Reusable patterns
- Best practices: docs/PINESCRIPT_BEST_PRACTICES.md
## Pine Script Patterns to Follow
### MSS (Market Structure Shift) Detection
- Bullish MSS: LH (Lower High) LL (Lower Low) sharp reversal UP with FVG HH breaks above LH
- Bearish MSS: HL (Higher Low) HH (Higher High) sharp reversal DOWN with FVG LL breaks below HL
- FVG must be present between the last extreme (LL for bullish, HH for bearish) and the breakout candle
- Reference: templates/pinescript/utilities/mss_detector.pine
### FVG (Fair Value Gap) Selection Rules
- 1 FVG = use it
- 2 FVGs = use upper (closest to price)
- 3+ FVGs = always use 2nd from top
- FVG can be at the same level as the swing
- Reference: templates/pinescript/utilities/fvg_detector.pine
### Code Standards
- Always use //@version=6
- Use var for persistent state variables
- Check array size before accessing: if array.size(arr) > 0
- Avoid repainting: use [1] or confirmed swings
- Prefix helper functions with f_: f_detect_mss(), f_select_fvg()
- Add debug flags: show_debug = input.bool(false, 'Debug Mode')
### Multi-Timeframe Pattern
- Use request.security() for higher timeframes
- Block-based lookback: H1=24h, M15=6h, M5=90min
- Timeframe cascade: H1 M15 M5
### Quarter Theory
- Session anchor: 18:00 ET (configurable)
- Quarter system depends on timeframe (micro/90min/6hour/daily/weekly)
- Reference: templates/pinescript/utilities/quarter_utils.pine
## When Writing Pine Script Code
1. Reference templates from templates/pinescript/ as starting points
2. Follow best practices from docs/PINESCRIPT_BEST_PRACTICES.md
3. Add debug flags for development
4. Test on multiple timeframes (M5, M15, H1)
5. Avoid repainting - always use historical data