--

Hi Bobby, here you go.

Please have in mind that bots are risky and they might work only in certain market conditions. They might work yesterday and stop working tody.

Please use it only for educational purposes.

//@version=5

strategy("Bollinger Bands Breakout Strategy", overlay=true, pyramiding=100)

length = 20

stdDevMultiplier = 2

// Calculate Bollinger Bands

lowerBand = ta.sma(close, length) - stdDevMultiplier * ta.stdev(close, length)

upperBand = ta.sma(close, length) + stdDevMultiplier * ta.stdev(close, length)

// Plot Bollinger Bands on the chart

plot(lowerBand, "Lower Band", color=color.blue)

plot(upperBand, "Upper Band", color=color.red)

// Generate buy condition when price crosses below the lower band

buyCondition = ta.crossover(close, lowerBand)

// Generate sell condition when price crosses above the upper band

sellCondition = ta.crossunder(close, upperBand)

// Execute buy order based on the buy condition

if (buyCondition)

strategy.entry("Buy", strategy.long)

// Close the position when the sell condition is met

if (sellCondition)

strategy.close("Buy")

--

--

Henrique Centieiro & Bee Lee
Henrique Centieiro & Bee Lee

Written by Henrique Centieiro & Bee Lee

👑8X Medium Top Writer | ✍🏻AI, Tech, Crypto, Money, Investing, Mindset | 🧠Be part of our Be Limitless community: https://www.skool.com/be-limitless-4003/about

No responses yet