Appearance
Personalize your experience
Mode
Accent Color
Layout
Direction
Market Structure Break
FreeDetects BOS and CHoCH using swing pivot analysis
4.6(178)
3.4k installs 920 2 commentsA
smcmarket-structureboschochsmart-money
Live Preview — BTC/USDT
About
Identifies **Break of Structure** (BOS) and **Change of Character** (CHoCH) signals using swing high/low pivot detection.
Concepts
BOS: Continuation of the current trend (break of prior swing in trend direction)
CHoCH: Reversal signal (break against current trend)
• Uses configurable pivot length for sensitivity
Outputs & Parameters
Outputs
BOS Signalsdots
CHoCH Signalsdots
Parameters
Pivot Length5
Show BOStrue
Show CHoCHtrue
Source Code
Edit in IDEtypescript
| 1 | // Market Structure (BOS/CHoCH) — Quatick IDE |
| 2 | // Returns close deviation % from SMA as a structure oscillator. |
| 3 | // SDK math globals available: sma, ema, atr, rsi, macd, bollingerBands, vwap, etc. |
| 4 | |
| 5 | const metadata = { id: 'market-structure', name: 'Market Structure', version: '1.0.0', category: 'trend' }; |
| 6 | |
| 7 | interface BarData { |
| 8 | time: number; |
| 9 | open: number; |
| 10 | high: number; |
| 11 | low: number; |
| 12 | close: number; |
| 13 | volume?: number; |
| 14 | } |
| 15 | |
| 16 | const defaultParams = { period: 20, pivotLength: 5 }; |
| 17 | |
| 18 | /** |
| 19 | * Returns close-price deviation % from a smoothed baseline. |
| 20 | * Positive = price is above average (bullish bias), negative = below (bearish bias). |
| 21 | * Used as a proxy for market structure bias. |
| 22 | */ |
| 23 | function calculate(bars: BarData[], params = defaultParams): { time: number; value: number }[] { |
| 24 | const closes = bars.map(b => b.close); |
| 25 | const smaValues = sma(closes, params.period); |
| 26 | |
| 27 | return bars |
| 28 | .map((bar, i) => ({ |
| 29 | time: bar.time, |
| 30 | value: isNaN(smaValues[i]) ? NaN : ((bar.close - smaValues[i]) / smaValues[i]) * 100, |
| 31 | })) |
| 32 | .filter(p => !isNaN(p.value)); |
| 33 | } |
Read-only preview. Open in the QuaTick IDE to edit and deploy.
Reviews
No reviews yet. Be the first to review this listing.
Discussion
Sign in to join the discussion. Your posts and replies show up on your profile.