Prompt Title: Pine Script: SuperTrend+Fibonacci+Volume+S/R

Created 1 year ago
Votes 0
Views 353 times
0

Prompt Detail:

Here's an example Pine Script code that incorporates SuperTrend, Fibonacci Pivot Points, Volume, and Support and Resistance Levels with breaks:

makefile
//@version=5 strategy("SuperTrend + Fib Pivot Points + Volume + S/R Levels", overlay=true, margin_long=100, margin_short=100) // SuperTrend factor = input(title="Factor", defval=10, minval=1, maxval=100) atrPeriod = input(title="ATR Period", defval=10, minval=1, maxval=100) basis = hl2 tr = atr(atrPeriod) upperBand = basis + (factor * tr) lowerBand = basis - (factor * tr) inUptrend = close > nz(inUptrend[1]) ? (close < lowerBand[1] ? 1 : 0) : (close > upperBand[1] ? 0 : 1) color = inUptrend ? color.green : color.red superTrend = plot(basis, "SuperTrend", color=color, linewidth=2) // Fibonacci Pivot Points pivotHigh = highest(high, 5) pivotLow = lowest(low, 5) pivotRange = pivotHigh - pivotLow r3 = pivotHigh + 1.000 * pivotRange r2 = pivotHigh + 0.618 * pivotRange r1 = pivotHigh + 0.382 * pivotRange s1 = pivotLow - 0.382 * pivotRange s2 = pivotLow - 0.618 * pivotRange s3 = pivotLow - 1.000 * pivotRange // Support and Resistance Levels resistance1 = plot(r1, "Resistance 1", color=color.blue, linewidth=1, style=plot.style_stepline) resistance2 = plot(r2, "Resistance 2", color=color.blue, linewidth=1, style=plot.style_stepline) resistance3 = plot(r3, "Resistance 3", color=color.blue, linewidth=1, style=plot.style_stepline) support1 = plot(s1, "Support 1", color=color.red, linewidth=1, style=plot.style_stepline) support2 = plot(s2, "Support 2", color=color.red, linewidth=1, style=plot.style_stepline) support3 = plot(s3, "Support 3", color=color.red, linewidth=1, style=plot.style_stepline) // Volume showVolume = input(title="Show Volume?", defval=true) volumeColor = close > open ? color.green : color.red volume = plot(showVolume ? volume : na, "Volume", color=volumeColor, linewidth=1, style=plot.style_columns) // Buy/Sell signals breakAboveResistance1 = close > r1 and close[1] <= r1[1] breakAboveResistance2 = close > r2 and close[1] <= r2[1] breakAboveResistance3 = close > r3 and close[1] <= r3[1] breakBelowSupport1 = close < s1 and close[1] >= s1[1] breakBelowSupport2 = close < s2 and close[1] >= s2[1] breakBelowSupport3 = close < s3 and close[1] >= s3[1] buySignal = breakAboveResistance1 or breakAboveResistance2 or breakAboveResistance3 sellSignal = breakBelowSupport1 or breakBelowSupport2 or breakBelowSupport3 // Strategy longCondition = buySignal if (longCondition) strategy.entry("Buy", strategy.long) shortCondition = sellSignal if (shortCondition
avatar
kiran G
Shared 1 prompt
Created 1 year ago

Leave a Comment