This strategy executes gap breakout entries directly on the price chart, opening long positions when the current open exceeds the prior high and short positions when the open drops below the prior low.
1Copy the scriptPress Copy script above, or the copy button on the code below.
2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
3Paste over the templateCreate a new strategy, select all of the template text and paste. Press Save and give it a name.
4Add it to the chartPress Add to chart. The trades and results appear in the Strategy Tester tab; adjust the settings with the gear icon.
Source Code
223 lines of Pine Script v5 from Strategy/GOLD DIGGER .pine, published under MPL-2.0 (file header). Keep the author's credit and licence lines when you reuse it.
GOLD DIGGER .pine
// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
//@version=5
strategy("Gold Digger AI", overlay=true, precision=0, explicit_plot_zorder=true, max_labels_count=500)
if open > high[1]
strategy.entry("enter long", strategy.long, 1) // enter long by market if current open great then previous high
if open < low[1]
strategy.entry("enter short", strategy.short, 1) // enter short by market if current open less then previous low
// Get user input
// Get user input
sensitivity = input.float(4, "Sensitivity (0.5 - 4)", 0.5, 4, step=0.1)
emaCloud = input.bool(false, "EMA Cloud")
suppRes = input.bool(false, "Support & Resistance")
breaks = input.bool(false, "Breaks")
usePsar = input.bool(false, "PSAR")
emaEnergy = input.bool(true, "EMA Energy")
// Functions
supertrend(_src, factor, atrLen) =>
atr = ta.atr(atrLen)
upperBand = _src + factor * atr
lowerBand = _src - factor * atr
prevLowerBand = nz(lowerBand[1])
prevUpperBand = nz(upperBand[1])
lowerBand := lowerBand > prevLowerBand or close[1] < prevLowerBand ? lowerBand : prevLowerBand
upperBand := upperBand < prevUpperBand or close[1] > prevUpperBand ? upperBand : prevUpperBand
int direction = na
float superTrend = na
prevSuperTrend = superTrend[1]
if na(atr[1])
direction := 1
else if prevSuperTrend == prevUpperBand
direction := close > upperBand ? -1 : 1
else
direction := close < lowerBand ? 1 : -1
superTrend := direction == -1 ? lowerBand : upperBand
[superTrend, direction]
// Get Components
ocAvg = math.avg(open, close)
ema1 = ta.ema(high, 9)
ema2 = ta.ema(high, 12)
ema3 = ta.ema(high, 15)
ema4 = ta.ema(high, 18)
sma1 = ta.sma(close, 5)
sma2 = ta.sma(close, 6)
sma3 = ta.sma(close, 7)
sma4 = ta.sma(close, 8)
sma5 = ta.sma(close, 9)
sma6 = ta.sma(close, 10)
sma7 = ta.sma(close, 11)
sma8 = ta.sma(close, 12)
sma9 = ta.sma(close, 13)
sma10 = ta.sma(close, 14)
sma11 = ta.sma(close, 15)
sma12 = ta.sma(close, 16)
sma13 = ta.sma(close, 17)
sma14 = ta.sma(close, 18)
sma15 = ta.sma(close, 19)
sma16 = ta.sma(close, 20)
psar = ta.sar(0.02, 0.02, 0.2)
[supertrend, direction] = supertrend(close, sensitivity, 11)
barsL = 10
barsR = 10
pivotHigh = fixnan(ta.pivothigh(barsL, barsR)[1])
pivotLow = fixnan(ta.pivotlow(barsL, barsR)[1])
// Colors
green = #0290f6, green2 = #0290f6
red = #cf2dfc, red2 = #cf2dfc
emaCloudColor = emaCloud ? (close > supertrend ? #0290f6 : #cf2dfc) : na
emaEnergyColor(ma) => emaEnergy ? (close >= ma ? green : red) : na
// Plots
p1 = plot(ema1, "", na, editable=false)
p2 = plot(ema2, "", emaCloudColor, editable=false)
p3 = plot(ema3, "", emaCloudColor, editable=false)
p4 = plot(ema4, "", na, editable=false)
fill(p1, p2, emaCloud ? (ema2 > ema3 ? color.new(#cf2dfc, 80) : color.new(#0290f6, 80)) : na)
fill(p4, p3, emaCloud ? (ema2 < ema3 ? color.new(#cf2dfc, 80) : color.new(#0290f6, 80)) : na)
fill(p2, p3, emaCloud ? color.new(emaCloudColor, 35) : na)
plot(sma1, "", emaEnergyColor(sma1), editable=false)
plot(sma2, "", emaEnergyColor(sma2), editable=false)
plot(sma3, "", emaEnergyColor(sma3), editable=false)
plot(sma4, "", emaEnergyColor(sma4), editable=false)
plot(sma5, "", emaEnergyColor(sma5), editable=false)
plot(sma6, "", emaEnergyColor(sma6), editable=false)
plot(sma7, "", emaEnergyColor(sma7), editable=false)
plot(sma8, "", emaEnergyColor(sma8), editable=false)
plot(sma9, "", emaEnergyColor(sma9), editable=false)
plot(sma10, "", emaEnergyColor(sma10), editable=false)
plot(sma11, "", emaEnergyColor(sma11), editable=false)
plot(sma12, "", emaEnergyColor(sma12), editable=false)
plot(sma13, "", emaEnergyColor(sma13), editable=false)
plot(sma14, "", emaEnergyColor(sma14), editable=false)
plot(sma15, "", emaEnergyColor(sma15), editable=false)
plot(sma16, "", emaEnergyColor(sma16), editable=false)
barcolor(close > supertrend ? #0290f6 : red2)
p5 = plot(ocAvg, "", na, editable=false)
p6 = plot(psar, "PSAR", usePsar ? (psar < ocAvg ? green : red) : na, 1, plot.style_circles, editable=false)
fill(p5, p6, usePsar ? (psar < ocAvg ? color.new(green, 90) : color.new(red, 90)) : na, editable=false)
y1 = low - (ta.atr(30) * 2)
y2 = high + (ta.atr(30) * 2)
bull = ta.crossover(close, supertrend) and close >= sma9
bear = ta.crossunder(close, supertrend) and close <= sma9
buy = bull ? label.new(bar_index, y1, "BUY", xloc.bar_index, yloc.price, #0290f6, label.style_label_up, color.white, size.normal) : na
sell = bear ? label.new(bar_index, y2, "SELL", xloc.bar_index, yloc.price, red2, label.style_label_down, color.white, size.normal) : na
plot(pivotHigh, "Resistance", not suppRes or ta.change(pivotHigh) ? na : red, 2, offset=-(barsR + 1), editable=false)
plot(pivotLow, "Support", not suppRes or ta.change(pivotLow) ? na : green, 2, offset=-(barsR + 1), editable=false)
plotshape(breaks and ta.crossover(close, pivotHigh), "Break", shape.labelup, location.belowbar, green, 0, "B", color.white, false, size.small)
plotshape(breaks and ta.crossunder(close, pivotLow), "Break", shape.labeldown, location.abovebar, red, 0, "B", color.white, false, size.small)
// Alerts
alertcondition(bull or bear or ta.crossover(close, pivotHigh) or ta.crossunder(close, pivotLow), "Alert Any", "AI Signals Gold\nAlert Triggered on {{ticker}} @ {{close}}")
alertcondition(bull, "Alert Buy", "AI Signals Gold\nBuy {{ticker}} @ {{close}}")
alertcondition(bear, "Alert Sell", "AI Signals Gold\nSell {{ticker}} @ {{close}}")
alertcondition(ta.crossover(close, pivotHigh), "Broke Resistance", "AI Signals Gold\nBroke Resistance on {{ticker}} @ {{close}}")
alertcondition(ta.crossunder(close, pivotLow), "Broke Support", "AI Signals Gold\nBroke Support on {{ticker}} @ {{close}}")
// ==========================================================================================
Overview
Gold Digger AI overlays a custom Supertrend filter, an EMA cloud, a Parabolic SAR, pivot levels, and a multi-SMA energy ribbon across sixteen periods. Strategy entries operate independently of the plotted visual indicators and do not include stop-loss, take-profit, or dedicated exit rules.
The inputs you can change from the gear icon on the chart. Defaults are the author's.
Setting
Type
Default
Variable
Sensitivity (0.5 - 4)
float
4
sensitivity
EMA Cloud
bool
false
emaCloud
Support & Resistance
bool
false
suppRes
Breaks
bool
false
breaks
PSAR
bool
false
usePsar
EMA Energy
bool
true
emaEnergy
Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.
This strategy plots running pivot highs as red R circles and pivot lows as blue S circles directly on the price chart. It computes an EMA 3 and a Cto trend line from close prices, then generates long signals on upward EMA-Cto crossovers combined with price pos
This strategy executes trades based on crossovers between a 12-period and a 26-period exponential moving average (EMA). Long positions can be filtered by pivot resistance breakouts and RSI boundary ranges. For trade management, it provides two configurable par
This strategy trades long breakouts of a fast and a slow moving average on the price chart. It opens a long position when price crosses above either average, using a percentage of equity as size. It reduces the position by a set share when the high reaches the
This strategy executes trades on short-term cryptocurrency charts using a combination of pivot support and resistance levels and a multi-pole smoothed trend filter. Entries trigger when price crosses the smoothed trend line and confirms above or below a short-
This strategy trades longs and shorts on the price chart. Long entries require a close above the prior Donchian high, a close above a long-term SMA, and RSI above a threshold, with size set as a percentage of equity. Long exits use a stop at the prior Donchian
This strategy plots Donchian channels, trailing stops, and profit targets directly on the price chart. It enters breakout trades using a 55-bar Donchian channel and sizes positions according to an ATR-based risk percentage per unit. The system adds units as pr