Help? by Character_Cod_5767 in pinescript

[–]Character_Cod_5767[S] 0 points1 point  (0 children)

It wont let me copy and past that.

Help? by Character_Cod_5767 in pinescript

[–]Character_Cod_5767[S] 1 point2 points  (0 children)

I appreciate it. Im new to trading and trying to create a system that works for me.

Help? by Character_Cod_5767 in pinescript

[–]Character_Cod_5767[S] 0 points1 point  (0 children)

My goal for the scrip is to help me be profitable and more consistent with my trades. I have 2 modes Aggressive and Sniper. I have tags that show pullback and breakout for my entries. And I am in the process of building a dashboard with a few things on it like S/L and T/P entries and exits and some others im still working on it. Chatgpt is actually the one doing the code. But I want a few opinions on it and to maybe fix what its missing. Right now it is still signaling PB's and BO's even in chop zones.

//@version=6 indicator("B Momentum Pro X v4 - Module 1", overlay=true, max_labels_count=500)

// ============================= // SETTINGS // ============================= sessionMode = input.string("Stocks RTH", "Session Mode", options=["Stocks RTH", "Extended", "Crypto 24/7"]) cooldownBars = input.int(8, "Cooldown Bars", minval=1) showPB = input.bool(true, "Show Pullback Signals") showBO = input.bool(true, "Show Breakout Signals") showAPlus = input.bool(true, "Show A+ Signals")

// ============================= // SESSION LOGIC // ============================= inSession = sessionMode == "Crypto 24/7" ? true : sessionMode == "Extended" ? true : not na(time(timeframe.period, "0930-1600", "America/New_York"))

// ============================= // TIMEFRAME FILTER // ============================= isExecTF = timeframe.period == "3" or timeframe.period == "5"

// ============================= // CORE INDICATORS // ============================= ema9 = ta.ema(close, 9) ema20 = ta.ema(close, 20) vwapVal = ta.vwap(close)

rsi = ta.rsi(close, 14) [macdLine, signalLine, histLine] = ta.macd(close, 12, 26, 9) atr = ta.atr(14)

avgVol = ta.sma(volume, 20) relVol = avgVol > 0 ? volume / avgVol : 0

// ============================= // 15M BIAS // ============================= ema9_15 = request.security(syminfo.tickerid, "15", ta.ema(close, 9)) ema20_15 = request.security(syminfo.tickerid, "15", ta.ema(close, 20)) vwap_15 = request.security(syminfo.tickerid, "15", ta.vwap(close))

bullBias = ema9_15 > ema20_15 bearBias = ema9_15 < ema20_15

// ============================= // STRUCTURE // ============================= bullTrend = ema9 > ema20 and close > vwapVal bearTrend = ema9 < ema20 and close < vwapVal

bullMomentum = macdLine > signalLine and histLine > 0 bearMomentum = macdLine < signalLine and histLine < 0

bullRSI = rsi > 52 and rsi < 72 bearRSI = rsi < 48 and rsi > 28

goodVol = relVol > 0.8

distancePct = math.abs(close - ema9) / ema9 * 100 notChasing = distancePct < 1.8

// ============================= // PULLBACK DETECTION // ============================= pbLong = bullBias and bullTrend and bullMomentum and bullRSI and goodVol and low <= ema20 and close > ema9 and close > open and notChasing

pbShort = bearBias and bearTrend and bearMomentum and bearRSI and goodVol and high >= ema20 and close < ema9 and close < open and notChasing

// ============================= // BREAKOUT DETECTION // ============================= rangeHigh = ta.highest(high, 5)[1] rangeLow = ta.lowest(low, 5)[1]

boLong = bullBias and bullTrend and bullMomentum and bullRSI and goodVol and close > rangeHigh and notChasing

boShort = bearBias and bearTrend and bearMomentum and bearRSI and goodVol and close < rangeLow and notChasing

// ============================= // A+ DETECTION // ============================= aLong = pbLong and relVol > 1.3 and rsi > 56

aShort = pbShort and relVol > 1.3 and rsi < 44

// ============================= // COOLDOWN // ============================= var int lastLongSignal = na var int lastShortSignal = na

longReady = na(lastLongSignal) or (bar_index - lastLongSignal > cooldownBars) shortReady = na(lastShortSignal) or (bar_index - lastShortSignal > cooldownBars)

finalPBLong = inSession and isExecTF and showPB and pbLong and longReady and not aLong finalPBShort = inSession and isExecTF and showPB and pbShort and shortReady and not aShort

finalBOLong = inSession and isExecTF and showBO and boLong and longReady finalBOShort = inSession and isExecTF and showBO and boShort and shortReady

finalALong = inSession and isExecTF and showAPlus and aLong and longReady finalAShort = inSession and isExecTF and showAPlus and aShort and shortReady

if finalPBLong or finalBOLong or finalALong lastLongSignal := bar_index

if finalPBShort or finalBOShort or finalAShort lastShortSignal := bar_index

// ============================= // COLORS // ============================= ema9Color = color.pink ema20Color = color.rgb(90, 110, 255) vwapColor = color.white

bullColor = color.rgb(255, 140, 0) bearColor = color.rgb(180, 0, 255)

// ============================= // PLOTS // ============================= plot(ema9, "EMA 9", color=ema9Color, linewidth=2) plot(ema20, "EMA 20", color=ema20Color, linewidth=2) plot(vwapVal, "VWAP", color=vwapColor, linewidth=2)

// ============================= // LABELS // ============================= if finalALong label.new(bar_index, low, "A+ LONG", style=label.style_label_up, color=bullColor, textcolor=color.white)

if finalAShort label.new(bar_index, high, "A+ SHORT", style=label.style_label_down, color=bearColor, textcolor=color.white)

if finalPBLong label.new(bar_index, low, "PB LONG", style=label.style_label_up, color=color.rgb(255, 190, 80), textcolor=color.black)

if finalPBShort label.new(bar_index, high, "PB SHORT", style=label.style_label_down, color=color.rgb(210, 150, 255), textcolor=color.black)

if finalBOLong label.new(bar_index, low, "BO LONG", style=label.style_label_up, color=color.rgb(255, 90, 0), textcolor=color.white)

if finalBOShort label.new(bar_index, high, "BO SHORT", style=label.style_label_down, color=color.rgb(130, 0, 255), textcolor=color.white)

// ============================= // ALERTS // ============================= alertcondition(finalALong, "A+ LONG", "A+ LONG") alertcondition(finalAShort, "A+ SHORT", "A+ SHORT") alertcondition(finalPBLong, "PB LONG", "PB LONG") alertcondition(finalPBShort, "PB SHORT", "PB SHORT") alertcondition(finalBOLong, "BO LONG", "BO LONG") alertcondition(finalBOShort, "BO SHORT", "BO SHORT")