0% found this document useful (0 votes)
66 views2 pages

Inverted

This document is a Pine Script code for a trading indicator that generates buy and sell signals based on various technical analysis criteria including trend analysis, candle checks, volume checks, and indicators like RSI, MACD, and Stochastic Oscillator. It also incorporates engulfing candlestick patterns and sets stop loss and take profit levels. Alerts are included to notify users of strong buy or sell signals.

Uploaded by

noobleaderx
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
66 views2 pages

Inverted

This document is a Pine Script code for a trading indicator that generates buy and sell signals based on various technical analysis criteria including trend analysis, candle checks, volume checks, and indicators like RSI, MACD, and Stochastic Oscillator. It also incorporates engulfing candlestick patterns and sets stop loss and take profit levels. Alerts are included to notify users of strong buy or sell signals.

Uploaded by

noobleaderx
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

//@version=5

indicator("🔥 Comprehensive Trade Signals", overlay=true)

// === USER INPUTS ===


trendLength = input.int(20, title="SMA Trend Period")
volMultiplier = input.float(1.5, title="Volume Strength Multiplier")
minBodyPercent = input.float(0.3, title="Min Candle Body Size %")
rsilength = input.int(14, title="RSI Length")
macdShort = input.int(12, title="MACD Short Period")
macdLong = input.int(26, title="MACD Long Period")
macdSignal = input.int(9, title="MACD Signal Period")
stochKLength = input.int(14, title="Stochastic %K Length")
stopLossPercentage = input.float(1.0, title="Stop Loss Percentage", minval=0.1) //
Stop loss in percentage
takeProfitPercentage = input.float(2.0, title="Take Profit Percentage", minval=0.1)
// Take profit in percentage

// === TREND ANALYSIS ===


smaTrend = ta.sma(close, trendLength)
uptrend = close > smaTrend
downtrend = close < smaTrend

// === CANDLE CHECK ===


candleBody = math.abs(close - open)
candleRange = high - low
bodyPercent = (candleBody / (candleRange + 0.0001)) * 100
validBody = bodyPercent > minBodyPercent

// === VOLUME CHECK ===


volAvg = ta.sma(volume, 20)
volConfirmed = volume > volAvg * volMultiplier

// === RSI (Relative Strength Index) ===


rsiValue = ta.rsi(close, rsilength)
rsiOverbought = rsiValue > 70
rsiOversold = rsiValue < 30

// === MACD (Moving Average Convergence Divergence) ===


[macdLine, signalLine, _] = ta.macd(close, macdShort, macdLong, macdSignal)
macdBullish = macdLine > signalLine
macdBearish = macdLine < signalLine

// === STOCHASTIC OSCILLATOR ===


stochK = ta.stoch(close, high, low, stochKLength)
stochD = ta.sma(stochK, 3)
stochOverbought = stochK > 80
stochOversold = stochK < 20
stochBullish = stochK > stochD
stochBearish = stochK < stochD

// === ENGULFING CANDLESTICK PATTERNS ===


bullishEngulfing = close > open and close > open[1] and open <= close[1] and
close[1] < open[1]
bearishEngulfing = close < open and close < open[1] and open >= close[1] and
close[1] > open[1]

// === FINAL CONDITIONS ===


// Buy Conditions
buySignal = bullishEngulfing and validBody and volConfirmed and macdBullish and not
rsiOverbought and stochBullish and uptrend

// Sell Conditions
sellSignal = bearishEngulfing and validBody and volConfirmed and macdBearish and
not rsiOversold and stochBearish and downtrend

// === STOP LOSS and TAKE PROFIT ===


stopLossLevel = close * (1 - stopLossPercentage / 100)
takeProfitLevel = close * (1 + takeProfitPercentage / 100)

// === PLOTTING SIGNALS ===


plotshape(buySignal, title="Buy Signal", location=location.belowbar,
color=color.green, style=shape.labelup, text="BUY", textcolor=color.white)
plotshape(sellSignal, title="Sell Signal", location=location.abovebar,
color=color.red, style=shape.labeldown, text="SELL", textcolor=color.white)

// === PLOT STOP LOSS and TAKE PROFIT ===


plot(buySignal ? stopLossLevel : na, title="Stop Loss", color=color.red,
linewidth=2, style=plot.style_line)
plot(buySignal ? takeProfitLevel : na, title="Take Profit", color=color.green,
linewidth=2, style=plot.style_line)
plot(sellSignal ? stopLossLevel : na, title="Stop Loss", color=color.green,
linewidth=2, style=plot.style_line)
plot(sellSignal ? takeProfitLevel : na, title="Take Profit", color=color.red,
linewidth=2, style=plot.style_line)

// === ALERTS ===


alertcondition(buySignal, title="BUY Alert", message="🔥 Strong BUY Signal Detected!
Take action.")
alertcondition(sellSignal, title="SELL Alert", message="🔥 Strong SELL Signal
Detected! Take action.")

You might also like