// Function to detect inside bar is_inside_bar(open1, high1, low1, close1, open2, high2, low2, close2) => // Current candle is completely inside the previous candle's range high1 < high2 and low1 > low2
// 5-minute Inside Bar Detection is_inside_bar_5m = timeframe.isintraday and timeframe.multiplier == 5 and is_inside_bar(open, high, low, close, open[1], high[1], low[1], close[1])
// 15-minute Inside Bar Detection is_inside_bar_15m = timeframe.isintraday and timeframe.multiplier == 15 and is_inside_bar(open, high, low, close, open[1], high[1], low[1], close[1])
// 60-minute Inside Bar Detection is_inside_bar_60m = timeframe.isintraday and timeframe.multiplier == 60 and is_inside_bar(open, high, low, close, open[1], high[1], low[1], close[1])
// Daily Inside Bar Detection is_inside_bar_daily = timeframe.isdaily and timeframe.multiplier == 1 and is_inside_bar(open, high, low, close, open[1], high[1], low[1], close[1])
// Color selection for different timeframes var color color_5m = color.blue var color color_15m = color.green var color color_60m = color.red var color color_daily = color.purple
plotshape(timeframe_15m and is_inside_bar_15m, title="15m Inside Bar", location=location.belowbar, style=shape.triangleup, size=size.small, color=color_15m)
plotshape(timeframe_60m and is_inside_bar_60m, title="60m Inside Bar", location=location.belowbar, style=shape.triangleup, size=size.small, color=color_60m)
plotshape(timeframe_daily and is_inside_bar_daily, title="Daily Inside Bar", location=location.belowbar, style=shape.triangleup, size=size.small, color=color_daily)
// Alert Conditions alertcondition(timeframe_5m and is_inside_bar_5m, title="5m Inside Bar Alert", message="5-Minute Inside Bar Detected!")
alertcondition(timeframe_15m and is_inside_bar_15m, title="15m Inside Bar Alert", message="15-Minute Inside Bar Detected!")
alertcondition(timeframe_60m and is_inside_bar_60m, title="60m Inside Bar Alert", message="60-Minute Inside Bar Detected!")
alertcondition(timeframe_daily and is_inside_bar_daily, title="Daily Inside Bar Alert", message="Daily Inside Bar Detected!")
```
Key updates and improvements:
1. Updated to PineScript v6 syntax 2. Enhanced inside bar detection function 3. Added distinct colors for different timeframes - 5m: Blue - 15m: Green - 60m: Red - Daily: Purple
4. Added alert conditions for each timeframe 5. Maintained the original input toggles to enable/disable timeframe detection
Improvements in the inside bar detection: - Checks both intraday and daily timeframes - Uses `timeframe.isintraday` and `timeframe.isdaily` for precise detection - Verifies specific timeframe multipliers
To use the indicator: 1. Open TradingView 2. Go to Pine Editor 3. Paste the script 4. Add to chart 5. Configure timeframe visibility and alerts as needed
Would you like me to explain any part of the script or make any further modifications?
ברוח TradingView אמיתית, מחבר הסקריפט הזה פרסם אותו בקוד פתוח, כך שסוחרים יוכלו להבין ולאמת אותו. כל הכבוד למחבר! אתה יכול להשתמש בו בחינם, אבל השימוש החוזר בקוד זה בפרסום כפוף לכללי הבית. אתה יכול להכניס אותו למועדפים כדי להשתמש בו בגרף.
המידע והפרסומים אינם אמורים להיות, ואינם מהווים, עצות פיננסיות, השקעות, מסחר או סוגים אחרים של עצות או המלצות שסופקו או מאושרים על ידי TradingView. קרא עוד בתנאים וההגבלות.