Free Snippets
Pine Script Snippets for Prop Firm Trading
25 standalone, commented Pine Script blocks covering every safety mechanism a funded-account strategy needs — copy one into the Pine Editor and wire it into whatever entry logic you're already running.
Risk Management
9 snippetsStop distance scales with Average True Range instead of a fixed tick count, so risk tracks current volatility automatically.
All firms
Ratchets a stop behind price using trail_points and trail_offset once a trade moves in your favor, sized in ticks.
All firms
Shifts the stop to entry after a tick-based profit trigger, capping the worst case at roughly a scratch.
All firms
Scales out a portion of the position at a first target with qty_percent, then lets the remainder run toward a second.
All firms
Define the stop in ticks and let the take-profit auto-derive from your target reward-to-risk multiple.
All firms
Converts risk dollars, stop distance, and tick value into a contract count sized to a fixed per-trade risk.
All firms
Tracks peak strategy equity and blocks new entries once trailing drawdown closes in on your firm's limit.
Apex · Topstep · MFFU
Accumulates session P&L and halts new entries once losses reach a configured threshold — the core prop firm safety rail.
Apex · Topstep · FTMO
Halts entries once session profit hits a cap — built for Apex funded accounts under the consistency rule.
Apex
Session & Time Filters
9 snippetsRestricts entries to a configurable session window (RTH or custom), keeping trades out of thin overnight action.
All firms
Hour-range gate on the New York clock, with an optional midday exclusion window.
All firms
Blocks — or exclusively allows — entries during a configurable window right after the open.
All firms
Per-weekday toggles so a strategy can skip Mondays, sit out Fridays, or any combination you choose.
All firms
Non-repainting trend filter built on request.security with [1] and lookahead_off.
All firms
Blocks entries for a configurable window around scheduled high-impact news — CPI, FOMC, NFP.
All firms
Commission and tick-slippage settings plus a wide-bar entry skip for choppy conditions.
All firms
Forces entries onto confirmed bar closes only, eliminating the repainting that breaks live automation.
All firms
Closes every open position at a configurable time each session, so nothing survives into the overnight.
All firms
Alerts & Automation
3 snippetsBuilds the exact buy/sell/exit JSON payload TradersPost expects, assembled at runtime with alert().
Apex · Topstep · more
JSON alert payload shaped for PickMyTrade's routing to Apex, Tradeify, and Bulenox execution.
Apex · Tradeify · Bulenox
Builds alert text at runtime with str.tostring — symbol, price, size — instead of static dialog placeholders.
All firms
Prop Firm Rule Helpers
4 snippetsSession trade counter that blocks further entries once your daily cap is reached — an overtrading guard.
All firms
Halts new entries after N losing trades in a row — tilt protection written into the strategy itself.
All firms
Caps order size at a firm's scaling-plan contract limit so a sizing bug can't overshoot it.
Apex · Topstep
Auto-detects tick size and dollar-per-tick for MES, MNQ, ES, and NQ so position-sizing math stays correct across symbols.
All firms
Prop firm rules keep changing
Consistency rules, payout thresholds, contract limits — we log every dated change with sources so an automated strategy never runs on stale rules.
Track prop firm rule changes →