← All Analyses
NSENIFTY
Bullish

dvsBVdsv

Ayush
Ayush
1w ago
dvsBVdsv

//@version=5

indicator("Oracle Algo Suite Replica", overlay=true, precision=2)

// Inputs for the Trend Ribbon / Cloud

fast_len = input.int(10, title="Fast MA Length")

slow_len = input.int(20, title="Slow MA Length")

ma_type = input.string("EMA", title="MA Type", options=["EMA", "SMA"])

// Function to calculate moving averages

f_ma(type, src, len) =>

    type == "EMA" ? ta.ema(src, len) : ta.sma(src, len)

fast_ma = f_ma(ma_type, close, fast_len)

slow_ma = f_ma(ma_type, close, slow_len)

// Plotting the Cloud Ribbon

p1 = plot(fast_ma, title="Fast MA", color=color.new(color.green, 20))

p2 = plot(slow_ma, title="Slow MA", color=color.new(color.red, 20))

// Color the fill between the two moving averages (Green for bullish, Red/Purple for bearish)

cloud_color = fast_ma > slow_ma ? color.new(color.green, 60) : color.new(color.purple, 60)

fill(p1, p2, color=cloud_color, title="Trend Cloud")

// Signal Logic (Simulating Buy, Strong Buy, and Sell label triggers based on crossovers)

bullish_cross = ta.crossover(fast_ma, slow_ma)

bearish_cross = ta.crossunder(fast_ma, slow_ma)

// Strong signal condition (e.g., price momentum confirmation or wider separation)

strong_bullish = bullish_cross and (close - slow_ma) > ta.stdev(close, 20)

strong_bearish = bearish_cross and (slow_ma - close) > ta.stdev(close, 20)

// Plotting Buy / Sell / Strong Buy markers on chart

plotshape(bullish_cross and not strong_bullish, title="Buy Signal", style=shape.labelup, location=location.belowbar, color=color.green, text="Buy", textcolor=color.white, size=size.small)

plotshape(strong_bullish, title="Strong Buy Signal", style=shape.labelup, location=location.belowbar, color=color.new(color.green, 0), text="Strong Buy", textcolor=color.white, size=size.small)

plotshape(bearish_cross, title="Sell Signal", style=shape.labeldown, location=location.abovebar, color=color.red, text="Sell", textcolor=color.white, size=size.small)

// Alert conditions for automation

alertcondition(bullish_cross, title="Buy Alert", message="Oracle Algo: Buy Signal Triggered")

alertcondition(strong_bullish, title="Strong Buy Alert", message="Oracle Algo: Strong Buy Signal Triggered")

alertcondition(bearish_cross, title="Sell Alert", message="Oracle Algo: Sell Signal Triggered")

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by GoCharting. Read more in the Terms of Use.

Comments (1)

Loading comments…