This is BBjasonsdayBuy it buys over the 180 //@version=4 study(shorttitle="BBjasonsdaybuy", title="Bollinger Bands jasons day buy", overlay=true, resolution="") length = input(6, minval=1) src = input(low, title="Source") mult = input(.25, minval=0.001, maxval=50, title="StdDev") basis = sma(src, length) dev = mult * stdev(src, length) upper = basis + dev lower = basis - dev smaInput1 = input(9, title="SMA1") smaInput3 = input(180, title="SMA3") sma1 = sma(close, smaInput1) sma3 = sma(close, smaInput3) offset = input(0, "Offset", type = input.integer, minval = -500, maxval = 500) plot(basis, "Basis", color=#872323, offset = offset) p1 = plot(upper, "Upper", color=color.teal, offset = offset) p2 = plot(lower, "Lower", color=color.teal, offset = offset) fill(p1, p2, title = "Background", color=#198787, transp=95) Buy= iff(close>sma1[1], iff(close>sma3[1],crossover(close,upper),0),0) plotshape(Buy,title="Buy", color=color.green, style=shape.arrowup,location=location.belowbar, text="Buy") alertcondition (Buy, title="Buy Signal", message="Buy") Now I turned on the corresponding sell, it sells over the 180 //@version=4 study(shorttitle="BBjasonsday", title="Bollinger Bands jasons day", overlay=true, resolution="") length = input(28, minval=1) src = input(high, title="Source") mult = input(1.64, minval=0.001, maxval=50, title="StdDev") basis = sma(src, length) dev = mult * stdev(src, length) upper = basis + dev lower = basis - dev smaInput3 = input(180, title="SMA3") sma3 = sma(close, smaInput3) offset = input(0, "Offset", type = input.integer, minval = -500, maxval = 500) plot(basis, "Basis", color=#872323, offset = offset) p1 = plot(upper, "Upper", color=color.teal, offset = offset) p2 = plot(lower, "Lower", color=color.teal, offset = offset) fill(p1, p2, title = "Background", color=#198787, transp=95) Sell=iff (close>sma3[1],crossunder(close, upper),0) plotshape(Sell,title="Sell", color=color.red, style=shape.arrowdown,text="Sell") alertcondition(Sell, title="Sell Signal", message="Sell") This is the dip, it buys under the 180 and sells over the 180 //@version=4 study(shorttitle="DIPBuySellJasonsDay", title="Bollinger Bands jasons day", overlay=true, resolution="") length = input(28, minval=1) src = input(high, title="Source") mult = input(1.64, minval=0.001, maxval=50, title="StdDev") basis = sma(src, length) dev = mult * stdev(src, length) upper = basis + dev lower = basis - dev smaInput1 = input(9, title="SMA1") smaInput3 = input(180, title="SMA3") sma1 = sma(close, smaInput1) sma3 = sma(close, smaInput3) offset = input(0, "Offset", type = input.integer, minval = -500, maxval = 500) plot(basis, "Basis", color=#872323, offset = offset) p1 = plot(upper, "Upper", color=color.teal, offset = offset) p2 = plot(lower, "Lower", color=color.teal, offset = offset) fill(p1, p2, title = "Background", color=#198787, transp=95) Sell=iff (close>sma3[1],crossunder(close, upper),0) plotshape(Sell,title="Sell", color=color.red, style=shape.arrowdown,text="Sell") alertcondition(Sell, title="Sell Signal", message="Sell") //Buy= iff(close>sma1[1], iff(close>sma3[1],crossover(close,upper),0),0) Buy= iff (close(sma3[1] * 1.022),crossunder(close, upper),0) plotshape(Sell,title="Sell", color=color.red, style=shape.arrowdown,text="Sell") alertcondition(Sell, title="Sell Signal", message="Sell") Buy= iff(close>sma1[1], iff(close<(sma3[1] * .985),crossover(close,lower),0),0) //Buy= iff (close<(sma3[1] * .985),crossover(close, lower),0) plotshape(Buy,title="Buy", color=color.green, style=shape.arrowup,location=location.belowbar, text="Buy") alertcondition (Buy, title="Buy Signal", message="Buy") The Golden Sell, only sell above the Golden line SMA 600 This is useful on long dips, otherwise you may start selling over the 180 at a loss, this keeps you golden. //@version=4 study(shorttitle="GoldSellJasonsday", title="Bollinger Bands jasons day", overlay=true, resolution="") length = input(28, minval=1) src = input(high, title="Source") mult = input(1.64, minval=0.001, maxval=50, title="StdDev") basis = sma(src, length) dev = mult * stdev(src, length) upper = basis + dev lower = basis - dev smaInput1 = input(9, title="SMA1") smaInput2 = input(600, title="SMA2") smaInput3 = input(180, title="SMA3") sma1 = sma(close, smaInput1) sma2 = sma(close, smaInput2) sma3 = sma(close, smaInput3) offset = input(0, "Offset", type = input.integer, minval = -500, maxval = 500) plot(basis, "Basis", color=#872323, offset = offset) p1 = plot(upper, "Upper", color=color.teal, offset = offset) p2 = plot(lower, "Lower", color=color.teal, offset = offset) fill(p1, p2, title = "Background", color=#198787, transp=95) Sell=iff (close>(sma3[1] * 1.022), iff(close>sma2[1],crossunder(close,upper),0),0) //Sell= iff(close>sma3[1], iff(close>sma2[1],crossunder(close,upper),0),0) //Sell=iff (close>sma2[1],crossunder(close, upper),0) plotshape(Sell,title="Sell", color=color.red, style=shape.arrowdown,text="Sell") alertcondition(Sell, title="Sell Signal", message="Sell") This is accurate swing trading no buy under 180. //@version=4 study("Accurate Swing no buy less180",overlay=true) no=input(3,title="Swing") Barcolor=input(false,title="Barcolor") Bgcolor=input(false,title="Bgcolor") smaInput3 = input(180, title="SMA3") sma3 = sma(close, smaInput3) res=highest(high,no) sup=lowest(low,no) avd=iff(close>res[1],1,iff(closesma3[1],valuewhen(avd!=0,avd,0),0) tsl=iff(avn==1,sup,res) Buy=crossover(close,tsl) Sell=crossunder(close,tsl) plotshape(Buy,title="Buy", color=color.green, style=shape.arrowup,location=location.belowbar, text="Buy") plotshape(Sell,title="Sell", color=color.red, style=shape.arrowdown,text="Sell") colr = close>=tsl ? color.green : close<=tsl ? color.red : na plot(tsl, color=colr, linewidth=3, title="TSL") barcolor(Barcolor ? colr : na) bgcolor(Bgcolor ? colr :na) alertcondition (Buy, title="Buy Signal", message="Buy") alertcondition(Sell, title="Sell Signal", message="Sell") AND THE SMA CODE // © JasonOliver //@version=4 study(title="SMA 9/50/180 | EMA 20", overlay=true) smaInput1 = input(9, title="SMA1") smaInput2 = input(600, title="SMA2") smaInput3 = input(180, title="SMA3") smaInput8 = input(180, title="Sell") smaInput7 = input(180, title="BUY") emaInput1 = input(20, title="EMA1") sma1 = sma(close, smaInput1) sma2 = sma(close, smaInput2) sma3 = sma(close, smaInput3) sma8 = sma(close * 1.022, smaInput8) sma7 = sma(close * .985, smaInput7) EMA1 = ema(close, emaInput1) plot(sma1, color = color.red, title="SMA1") plot(sma2, color = color.yellow, title="SMA2") plot(sma3, color = color.white, title="SMA3") plot(sma8, color = color.green, title="SELL") plot(sma7, color = color.green, title="BUY") plot(EMA1, color = color.yellow, title="EMA1") plot(close) The strategy is it buys a lot, then you sell off the profits. Duh. Start with small buy amounts it adds up fast and go bigger on deep dips. You want your holdings to be below the 180 if that is not possible go to the golden sell. Once over the 180 you will begin to take profits. Don’t run out of buying power start small Be mindful of PDT (pattern day trading) there is a record in alpaca under account balances If PDT is a problem go with a longer interval. This will not work on all stocks but it works on many, its more about the pattern than anything else. Here is the json code for the alert {"ticker":"SPY","qty":"10","side":"sell","time_in_force":"day"} You can change variables for different actions {"ticker":"SPY","qty":"10","side":"buy","time_in_force":"day"} LONNYS CODE FOR SWITCHING FROM LIVE TO PAPER heres the json... {"ticker":"{{ticker}}","qty":"5","side":"buy","time_in_force":"gtc","live":0} need to add the following variables to the top of you code LIVE_API_KEY = "live_key" LIVE_SECRET_KEY = "live_secret" LIVE_BASE_URL = "https://api.alpaca.markets" LIVE_HEADERS = {'APCA-API-KEY-ID': LIVE_API_KEY, 'APCA-API-SECRET-KEY': LIVE_SECRET_KEY} LIVE_ORDERS_URL = "{}/v2/orders".format(LIVE_BASE_URL) LIVE_POSITIONS_URL = "{}/v2/positions/".format(LIVE_BASE_URL) Then for each order type replace this: r = requests.post(ORDERS_URL, json=data, headers=HEADERS) with this: if webhook_message['live'] == 1: r = requests.post(LIVE_ORDERS_URL, json=data, headers=LIVE_HEADERS) elif webhook_message['live'] == 0: r = requests.post(ORDERS_URL, json=data, headers=HEADERS) Lonnys Request for Spike Buy //@version=4 study(shorttitle="TheCreamBuyJasonsDay", title="Bollinger Bands jasons day", overlay=true, resolution="") length = input(28, minval=1) src = input(high, title="Source") mult = input(1.64, minval=0.001, maxval=50, title="StdDev") basis = sma(src, length) dev = mult * stdev(src, length) upper = basis + dev lower = basis - dev smaInput3 = input(180, title="SMA3") sma3 = sma(close, smaInput3) offset = input(0, "Offset", type = input.integer, minval = -500, maxval = 500) plot(basis, "Basis", color=#872323, offset = offset) p1 = plot(upper, "Upper", color=color.teal, offset = offset) p2 = plot(lower, "Lower", color=color.teal, offset = offset) fill(p1, p2, title = "Background", color=#198787, transp=95) Sell=iff (close>sma3[1],crossunder(close, upper),0) plotshape(Sell,title="Sell", color=color.red, style=shape.arrowdown,text="Sell") alertcondition(Sell, title="Sell Signal", message="Sell") Buy= iff (close>sma3[1],crossover(close, upper),0) plotshape(Buy,title="Buy", color=color.green, style=shape.arrowup,location=location.belowbar, text="Buy") alertcondition (Buy, title="Buy Signal", message="Buy") //@version=4 study(shorttitle="GoldSell4Jasonsday", title="Bollinger Bands jasons day", overlay=true, resolution="") length = input(28, minval=1) src = input(high, title="Source") mult = input(1.64, minval=0.001, maxval=50, title="StdDev") basis = sma(src, length) dev = mult * stdev(src, length) upper = basis + dev lower = basis - dev smaInput1 = input(9, title="SMA1") smaInput2 = input(2000, title="SMA2") smaInput3 = input(180, title="SMA3") smaInput4 = input(600, title="SMA4") sma1 = sma(close, smaInput1) sma2 = sma(close, smaInput2) sma3 = sma(close, smaInput3) sma4 = sma(close, smaInput4) offset = input(0, "Offset", type = input.integer, minval = -500, maxval = 500) plot(basis, "Basis", color=#872323, offset = offset) p1 = plot(upper, "Upper", color=color.teal, offset = offset) p2 = plot(lower, "Lower", color=color.teal, offset = offset) fill(p1, p2, title = "Background", color=#198787, transp=95) Sell=iff (close>sma4[1], iff (close>(sma3[1] * 1.022), iff(close>sma2[1],crossunder(close,upper),0),0),0) //Sell= iff(close>sma3[1], iff(close>sma2[1],crossunder(close,upper),0),0) //Sell=iff (close>sma2[1],crossunder(close, upper),0) plotshape(Sell,title="Sell", color=color.red, style=shape.arrowdown,text="Sell") alertcondition(Sell, title="Sell Signal", message="Sell") //@version=4 study(shorttitle="GoldSell5Jasonsday", title="Bollinger Bands jasons day", overlay=true, resolution="") length = input(28, minval=1) src = input(high, title="Source") mult = input(1.64, minval=0.001, maxval=50, title="StdDev") basis = sma(src, length) dev = mult * stdev(src, length) upper = basis + dev lower = basis - dev smaInput1 = input(9, title="SMA1") smaInput2 = input(2000, title="SMA2") smaInput3 = input(180, title="SMA3") smaInput4 = input(600, title="SMA4") sma1 = sma(close, smaInput1) sma2 = sma(close, smaInput2) sma3 = sma(close, smaInput3) sma4 = sma(close, smaInput4) offset = input(0, "Offset", type = input.integer, minval = -500, maxval = 500) plot(basis, "Basis", color=#872323, offset = offset) p1 = plot(upper, "Upper", color=color.teal, offset = offset) p2 = plot(lower, "Lower", color=color.teal, offset = offset) fill(p1, p2, title = "Background", color=#198787, transp=95) Sell=iff (sma4[1]>sma2[1],iff (close>sma4[1], iff (close>(sma3[1] * 1.022), iff(close>sma2[1],crossunder(close,upper),0),0),0),0) //Sell= iff(close>sma3[1], iff(close>sma2[1],crossunder(close,upper),0),0) //Sell=iff (close>sma2[1],crossunder(close, upper),0) plotshape(Sell,title="Sell", color=color.red, style=shape.arrowdown,text="Sell") alertcondition(Sell, title="Sell Signal", message="Sell") //@version=4 study(shorttitle="DEEP5JasonsDay", title="Bollinger Bands jasons day", overlay=true, resolution="") length = input(28, minval=1) src = input(high, title="Source") mult = input(1.64, minval=0.001, maxval=50, title="StdDev") basis = sma(src, length) dev = mult * stdev(src, length) upper = basis + dev lower = basis - dev smaInput1 = input(9, title="SMA1") smaInput3 = input(180, title="SMA3") smaInput4 = input(600, title="SMA4") smaInput5 = input(2000, title="SMA5") sma1 = sma(close, smaInput1) sma3 = sma(close, smaInput3) sma4 = sma(close, smaInput4) sma5 = sma(close, smaInput5) offset = input(0, "Offset", type = input.integer, minval = -500, maxval = 500) plot(basis, "Basis", color=#872323, offset = offset) p1 = plot(upper, "Upper", color=color.teal, offset = offset) p2 = plot(lower, "Lower", color=color.teal, offset = offset) fill(p1, p2, title = "Background", color=#198787, transp=95) Sell=iff (close>(sma3[1] * 1.022),crossunder(close, upper),0) plotshape(Sell,title="Sell", color=color.red, style=shape.arrowdown,text="_") alertcondition(Sell, title="Sell Signal", message="Sell") Buy= iff(sma4[1]sma1[1], iff(close<(sma3[1] * .985),crossover(close,lower),0),0),0) //Buy= iff (close<(sma3[1] * .985),crossover(close, lower),0) plotshape(Buy,title="Buy", color=color.green, style=shape.arrowup,location=location.belowbar, text="Buy") alertcondition (Buy, title="Buy Signal", message="Buy") ________________ Whole set config strat in layers //@version=4 study(shorttitle="DEEP5JasonsDay", title="Bollinger Bands jasons day", overlay=true, resolution="") length = input(28, minval=1) src = input(high, title="Source") mult = input(1.64, minval=0.001, maxval=50, title="StdDev") basis = sma(src, length) dev = mult * stdev(src, length) upper = basis + dev lower = basis - dev smaInput1 = input(9, title="SMA1") smaInput3 = input(180, title="SMA3") smaInput4 = input(600, title="SMA4") smaInput5 = input(2000, title="SMA5") sma1 = sma(close, smaInput1) sma3 = sma(close, smaInput3) sma4 = sma(close, smaInput4) sma5 = sma(close, smaInput5) offset = input(0, "Offset", type = input.integer, minval = -500, maxval = 500) plot(basis, "Basis", color=#872323, offset = offset) p1 = plot(upper, "Upper", color=color.teal, offset = offset) p2 = plot(lower, "Lower", color=color.teal, offset = offset) fill(p1, p2, title = "Background", color=#198787, transp=95) Sell=iff (close>(sma3[1] * 1.022),crossunder(close, upper),0) plotshape(Sell,title="Sell", color=color.red, style=shape.arrowdown,text="_") alertcondition(Sell, title="Sell Signal", message="Sell") Buy= iff(sma4[1]sma1[1], iff(close<(sma3[1] * .985),crossover(close,lower),0),0),0) //Buy= iff (close<(sma3[1] * .985),crossover(close, lower),0) plotshape(Buy,title="Buy", color=color.green, style=shape.arrowup,location=location.belowbar, text="Buy") alertcondition (Buy, title="Buy Signal", message="Buy") //@version=4 study(shorttitle="DEEP6JasonsDay", title="Bollinger Bands jasons day", overlay=true, resolution="") length = input(28, minval=1) src = input(high, title="Source") mult = input(1.64, minval=0.001, maxval=50, title="StdDev") basis = sma(src, length) dev = mult * stdev(src, length) upper = basis + dev lower = basis - dev smaInput1 = input(9, title="SMA1") smaInput3 = input(180, title="SMA3") smaInput4 = input(600, title="SMA4") smaInput5 = input(2000, title="SMA5") sma1 = sma(close, smaInput1) sma3 = sma(close, smaInput3) sma4 = sma(close, smaInput4) sma5 = sma(close, smaInput5) offset = input(0, "Offset", type = input.integer, minval = -500, maxval = 500) plot(basis, "Basis", color=#872323, offset = offset) p1 = plot(upper, "Upper", color=color.teal, offset = offset) p2 = plot(lower, "Lower", color=color.teal, offset = offset) fill(p1, p2, title = "Background", color=#198787, transp=95) Sell=iff (close>(sma3[1] * 1.022),crossunder(close, upper),0) plotshape(Sell,title="Sell", color=color.red, style=shape.arrowdown,text="_") alertcondition(Sell, title="Sell Signal", message="Sell") Buy= iff(sma4[1]sma1[1], iff(close<(sma3[1] * .985), iff(close<(sma4[1] * .88),crossover(close,lower),0),0),0),0) //Buy= iff (close<(sma3[1] * .985),crossover(close, lower),0) plotshape(Buy,title="Buy", color=color.green, style=shape.arrowup,location=location.belowbar, text="Buy") alertcondition (Buy, title="Buy Signal", message="Buy") //@version=4 study(title="SMA 9/50/180 | EMA 20", overlay=true) smaInput1 = input(9, title="SMA1") smaInput2 = input(600, title="SMA2") smaInput3 = input(180, title="SMA3") smaInput8 = input(180, title="Sell") smaInput7 = input(180, title="BUY") emaInput1 = input(20, title="EMA1") smaInput9 = input(2000, title="GS3") smaInput6 = input(600, title="Gbuy") smaInput4 = input(600, title="Gsell") sma1 = sma(close, smaInput1) sma2 = sma(close, smaInput2) sma3 = sma(close, smaInput3) sma8 = sma(close * 1.022, smaInput8) sma7 = sma(close * .985, smaInput7) EMA1 = ema(close, emaInput1) sma9 = sma(close, smaInput9) sma6 = sma(close * .88, smaInput6) sma4 = sma(close * 1.1, smaInput4) plot(sma1, color = color.red, title="SMA1") plot(sma2, color = color.yellow, title="SMA2") plot(sma3, color = color.white, title="SMA3") plot(sma8, color = color.green, title="SELL") plot(sma7, color = color.green, title="BUY") plot(EMA1, color = color.yellow, title="EMA1") plot(sma9, color = color.yellow, title="GS3") plot(sma6, color = color.green, title="Gbuy") plot(sma4, color = color.green, title="Gsell") plot(close) //@version=4 study(shorttitle="GoldSell4Jasonsday", title="Bollinger Bands jasons day", overlay=true, resolution="") length = input(28, minval=1) src = input(high, title="Source") mult = input(1.64, minval=0.001, maxval=50, title="StdDev") basis = sma(src, length) dev = mult * stdev(src, length) upper = basis + dev lower = basis - dev smaInput1 = input(9, title="SMA1") smaInput2 = input(2000, title="SMA2") smaInput3 = input(180, title="SMA3") smaInput4 = input(600, title="SMA4") sma1 = sma(close, smaInput1) sma2 = sma(close, smaInput2) sma3 = sma(close, smaInput3) sma4 = sma(close, smaInput4) offset = input(0, "Offset", type = input.integer, minval = -500, maxval = 500) plot(basis, "Basis", color=#872323, offset = offset) p1 = plot(upper, "Upper", color=color.teal, offset = offset) p2 = plot(lower, "Lower", color=color.teal, offset = offset) fill(p1, p2, title = "Background", color=#198787, transp=95) Sell=iff (close>sma4[1], iff (close>(sma3[1] * 1.022), iff(close>sma2[1],crossunder(close,upper),0),0),0) //Sell= iff(close>sma3[1], iff(close>sma2[1],crossunder(close,upper),0),0) //Sell=iff (close>sma2[1],crossunder(close, upper),0) plotshape(Sell,title="Sell", color=color.red, style=shape.arrowdown,text="Sell") alertcondition(Sell, title="Sell Signal", message="Sell") //@version=4 study(shorttitle="GoldSell5Jasonsday", title="Bollinger Bands jasons day", overlay=true, resolution="") length = input(28, minval=1) src = input(high, title="Source") mult = input(1.64, minval=0.001, maxval=50, title="StdDev") basis = sma(src, length) dev = mult * stdev(src, length) upper = basis + dev lower = basis - dev smaInput1 = input(9, title="SMA1") smaInput2 = input(2000, title="SMA2") smaInput3 = input(180, title="SMA3") smaInput4 = input(600, title="SMA4") sma1 = sma(close, smaInput1) sma2 = sma(close, smaInput2) sma3 = sma(close, smaInput3) sma4 = sma(close, smaInput4) offset = input(0, "Offset", type = input.integer, minval = -500, maxval = 500) plot(basis, "Basis", color=#872323, offset = offset) p1 = plot(upper, "Upper", color=color.teal, offset = offset) p2 = plot(lower, "Lower", color=color.teal, offset = offset) fill(p1, p2, title = "Background", color=#198787, transp=95) Sell=iff (sma4[1]>sma2[1],iff (close>sma4[1], iff (close>(sma3[1] * 1.022), iff(close>sma2[1],crossunder(close,upper),0),0),0),0) //Sell= iff(close>sma3[1], iff(close>sma2[1],crossunder(close,upper),0),0) //Sell=iff (close>sma2[1],crossunder(close, upper),0) plotshape(Sell,title="Sell", color=color.red, style=shape.arrowdown,text="Sell") alertcondition(Sell, title="Sell Signal", message="Sell") //@version=4 study(shorttitle="GoldSell6Jasonsday", title="Bollinger Bands jasons day", overlay=true, resolution="") length = input(28, minval=1) src = input(high, title="Source") mult = input(1.64, minval=0.001, maxval=50, title="StdDev") basis = sma(src, length) dev = mult * stdev(src, length) upper = basis + dev lower = basis - dev smaInput1 = input(9, title="SMA1") smaInput2 = input(2000, title="SMA2") smaInput3 = input(180, title="SMA3") smaInput4 = input(600, title="SMA4") sma1 = sma(close, smaInput1) sma2 = sma(close, smaInput2) sma3 = sma(close, smaInput3) sma4 = sma(close, smaInput4) offset = input(0, "Offset", type = input.integer, minval = -500, maxval = 500) plot(basis, "Basis", color=#872323, offset = offset) p1 = plot(upper, "Upper", color=color.teal, offset = offset) p2 = plot(lower, "Lower", color=color.teal, offset = offset) fill(p1, p2, title = "Background", color=#198787, transp=95) Sell=iff(close > (sma4 * 1.1),iff (sma4[1]>sma2[1],iff (close>sma4[1], iff (close>(sma3[1] * 1.022), iff(close>sma2[1],crossunder(close,upper),0),0),0),0),0) //Sell= iff(close>sma3[1], iff(close>sma2[1],crossunder(close,upper),0),0) //Sell=iff (close>sma2[1],crossunder(close, upper),0) plotshape(Sell,title="Sell", color=color.red, style=shape.arrowdown,text="Sell") alertcondition(Sell, title="Sell Signal", message="Sell") //@version=4 study(shorttitle="DEEP2JasonsDay", title="Bollinger Bands jasons day", overlay=true, resolution="") length = input(28, minval=1) src = input(high, title="Source") mult = input(1.64, minval=0.001, maxval=50, title="StdDev") basis = sma(src, length) dev = mult * stdev(src, length) upper = basis + dev lower = basis - dev smaInput1 = input(9, title="SMA1") smaInput3 = input(180, title="SMA3") sma1 = sma(close, smaInput1) sma3 = sma(close, smaInput3) offset = input(0, "Offset", type = input.integer, minval = -500, maxval = 500) plot(basis, "Basis", color=#872323, offset = offset) p1 = plot(upper, "Upper", color=color.teal, offset = offset) p2 = plot(lower, "Lower", color=color.teal, offset = offset) fill(p1, p2, title = "Background", color=#198787, transp=95) Sell=iff (close>(sma3[1] * 1.022),crossunder(close, upper),0) plotshape(Sell,title="Sell", color=color.red, style=shape.arrowdown,text="_") alertcondition(Sell, title="Sell Signal", message="Sell") Buy= iff(close>sma1[1], iff(close<(sma3[1] * .985),crossover(close,lower),0),0) //Buy= iff (close<(sma3[1] * .985),crossover(close, lower),0) plotshape(Buy,title="Buy", color=color.green, style=shape.arrowup,location=location.belowbar, text="Buy") alertcondition (Buy, title="Buy Signal", message="Buy") FOREX //@version=4 study(shorttitle="DIPBuySellJasonsDay", title="Bollinger Bands jasons day", overlay=true, resolution="") length = input(28, minval=1) src = input(high, title="Source") mult = input(1.64, minval=0.001, maxval=50, title="StdDev") basis = sma(src, length) dev = mult * stdev(src, length) upper = basis + dev lower = basis - dev smaInput1 = input(9, title="SMA1") smaInput2 = input(600, title="SMA2") smaInput3 = input(180, title="SMA3") smaInput4 = input(2000, title="SMA4") sma1 = sma(close, smaInput1) sma2 = sma(close, smaInput2) sma3 = sma(close, smaInput3) sma4 = sma(close, smaInput4) offset = input(0, "Offset", type = input.integer, minval = -500, maxval = 500) plot(basis, "Basis", color=#872323, offset = offset) p1 = plot(upper, "Upper", color=color.teal, offset = offset) p2 = plot(lower, "Lower", color=color.teal, offset = offset) fill(p1, p2, title = "Background", color=#198787, transp=95) Sell= iff (close>(sma3[1] * 1.002), iff(close>sma4[1],crossunder(close,upper),0),0) plotshape(Sell,title="Sell", color=color.red, style=shape.arrowdown,text="Sell") alertcondition(Sell, title="Sell Signal", message="Sell") //Buy= iff(close>sma1[1], iff(close>sma3[1],crossover(close,upper),0),0) Buy= iff (closesma4[1], iff (close>(sma3[1] * 1.002), iff(close>sma4[1],crossunder(close,upper),0),0),0) plotshape(Sell,title="Sell", color=color.red, style=shape.arrowdown,text="Sell") alertcondition(Sell, title="Sell Signal", message="Sell") //Buy= iff(close>sma1[1], iff(close>sma3[1],crossover(close,upper),0),0) Buy=iff (sma4[1]>sma2[1], iff (close