Add order block trading strategies and signals indicators#1
Open
iamyourmaker wants to merge 6 commits intoTradersPost:mainfrom
Open
Conversation
This indicator provides automated trading signals based on smart money order blocks and market structure analysis. Key features include: - Market structure detection (BOS/CHoCH) - Volumetric order block identification - Automated entry signals with TP/SL levels - Risk:Reward ratio calculation - Real-time signal status tracking - Comprehensive alert system - Customizable visual elements Entry signals are generated when price returns to unmitigated order blocks aligned with the current market structure trend.
- Fixed TradeSignal initialization: changed isBullish=na to isBullish=false to match expected series bool type - Fixed calcATR scope issue: moved ATR calculation to global scope before conditionals to ensure it's called on every bar for consistency - Removed redundant calcATR calls from inside conditional blocks These fixes resolve the type mismatch and function scope errors.
The error occurred when array size was less than or equal to obShowCount, causing an invalid loop (counting from smaller to larger with negative step). Changes: - Store array sizes in variables before loop to prevent recalculation - Add safety check inside loop to prevent index out of bounds - Add descriptive comments for clarity This fixes: "Error: 'step' in loop must be greater than zero"
Pine Script requires the 'step' parameter to always be positive, even when counting down. This was causing runtime errors with 'by -1'. Solution: Replace for loops with while loops that: - Remove items one at a time from the end of arrays - Continue until array size matches the display count - Simpler, clearer, and avoids step parameter issues entirely Fixes: "Error: 'step' in loop must be greater than zero"
Visual improvements for cleaner, more professional appearance: Order Blocks: - Remove borders (border_color=na) for cleaner look - Use separate extension boxes instead of extend parameter on main box - Maintain color scheme but simplify presentation Entry Signals: - Simplified labels to just "LONG" or "SHORT" (removed detailed info) - Made labels smaller (size.small) and more transparent (90% vs 80%) - Reduced line width from 2 to 1 for subtler appearance - Updated status labels to "LONG ✓"/"SHORT ✓" for TP hits - Updated status labels to "LONG ✗"/"SHORT ✗" for SL hits This matches the clean, minimal visual style of the BigBeluga indicator.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds two comprehensive TradingView Pine Script tools for trading order blocks based on Smart Money Concepts (SMC) and Inner Circle Trader (ICT) methodologies.
Changes
1. Order Block Trading Strategy (
order-block-smart-money-strategy.pine)A complete automated trading strategy that:
Key Features:
2. Order Block Trading Signals Indicator (
orderblock-trading-signals.pine)An advanced indicator for manual and semi-automated trading that:
Key Features:
Implementation Details
Use Cases
https://claude.ai/code/session_01C3yWkiZxxmnhZCYhqp3cXW