OPEN-SOURCE SCRIPT

LetzGO Inside Bar Indicator With Alert

I'll help you update the script to version 6 with some improvements and add alert conditions.



```pine
//version=6
indicator("LetzGO Inside Bar Indicator", overlay=true)

// Input for timeframe selection
timeframe_5m = input.bool(true, "Enable 5-minute Inside Bars")
timeframe_15m = input.bool(true, "Enable 15-minute Inside Bars")
timeframe_60m = input.bool(true, "Enable 60-minute Inside Bars")
timeframe_daily = input.bool(true, "Enable Daily Inside Bars")

// 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

// Plot visual indicators
plotshape(timeframe_5m and is_inside_bar_5m,
title="5m Inside Bar",
location=location.belowbar,
style=shape.triangleup,
size=size.small,
color=color_5m)

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?
Candlestick analysisChart patternsmultitimeframe

开源脚本

本着真正的TradingView精神,此脚本的作者已将其开源,以便交易者可以理解和验证它。向作者致敬!您可以免费使用它,但在出版物中重复使用此代码受网站规则约束。 您可以收藏它以在图表上使用。

想在图表上使用此脚本?

免责声明