TradingView تردنج فيو mt4 mt5
1.13K subscribers
936 photos
10 videos
1.99K files
268 links
🚀 Welcome to the ultimate Trading Indicators Hub! 📊 We provide premium trading indicators for TradingView, MT4, and MT5 to help you master the Forex, Stocks, and Cryptocurrency markets. Get access to powerful technical analysis tools, including trend-
Download Telegram
indicator("US stocks above Pre-Mkt", "PMH cross")
import TradingView/ta/10
// I want the Watchlist alerts to fire only when the Open of the 30 second candle is above PMH)

var PMH =0.000 //pre-mkt High
var PM_Open = 0.000
if session.ispremarket and not session.ispremarket[1]
PMH := high
PM_Open := open
else if session.ispremarket
PMH := math.max(PMH, high)

Present_Day_High = ta.highestSince(session.isfirstbar,high) // present Day high including Pre-mkt open high

// Regular Trading Hours levels
Day_Open =ta.valuewhen(session.isfirstbar_regular, open, 0)
RTH_DayHigh = ta.highestSince(session.isfirstbar_regular,high)

[O,H,L,C] = request.security(ticker.new(syminfo.prefix, syminfo.ticker, session.extended), "D", [open,high,low,close], barmerge.gaps_on) //// H = Pre-Mkt High is plotting wrong value

plot(H, title = "PMH",style = plot.style_linebr, color= #4af00e) // it is giving wrong value, as for ticker "QUBT" PMH is 14.73 but it is plotting 15.02?


[EMA20,CL1d,Hd,Ld,ClT]= request.security(syminfo.tickerid,"D",[ta.ema(close,20),close,high,low,ta.highest(close,10)]) //Daily levels
[VSM20,op_1,hi_1,lw_1,cl_1,vol_1]=request.security(syminfo.tickerid,"1",[ta.sma(volume,20),open,high,low,close,volume]) //For 1 minute volume values

var C1 = 0.00 // Previous Day close
if session.isfirstbar
C1 := CL1d[1]

// // Further NO watchlist alert fired for any stock for condition (open>H)

if open>H and RTH_DayHigh==Present_Day_High and RTH_DayHigh>=PMH and (close>C1) and close>Day_Open and close>=ClT and (vol_1>=VSM20 ) and (close>open or close>close[1])
alert("📩:"+str.tostring(syminfo.ticker) + str.format(" @ {0}!\n",close),freq =alert.freq_once_per_bar)
John_B_F:
//@version=6
indicator("MMS Pro Strategy", overlay=true, precision=2)

// === INPUTS ===
fib_level = input.float(78.6, "Fibonacci Entry Level (%)", step=0.1, minval=50, maxval=100)
rvol_length = input.int(20, "RVOL Length", minval=5)
rvol_threshold = input.float(1.5, "Min RVOL Threshold", step=0.1)
show_fib = input.bool(true, "Show Fibonacci Entry Zone")
highlight_trend = input.bool(true, "Highlight Trend Bias")
show_rvol_label = input.bool(false, "Show RVOL Label")

// === ALERTS CONFIGURATION ===
sound_alert = input.bool(true, "Enable Sound Alerts")
visual_alert = input.bool(true, "Enable Visual Alerts")

// === RSI DIVERGENCE SETTINGS ===
use_divergence = input.bool(true, "Use RSI Divergence", group="RSI Settings")
rsi_length = input.int(14, "RSI Length", minval=5, group="RSI Settings")
div_lookback = input.int(3, "Divergence Lookback Period", minval=1, group="RSI Settings")
rsi_oversold = input.int(30, "RSI Oversold", minval=0, maxval=50, group="RSI Settings")
rsi_overbought = input.int(70, "RSI Overbought", minval=50, maxval=100, group="RSI Settings")

// === TRAILING STOP SETTINGS ===
use_trailing = input.bool(true, "Use Trailing Stop", group="Trailing Stop")
trail_type = input.string("ATR", "Trail Type", options=["ATR", "Fixed"], group="Trailing Stop")
atr_length = input.int(14, "ATR Length", minval=1, group="Trailing Stop")
atr_mult = input.float(2.0, "ATR Multiplier", step=0.1, group="Trailing Stop")
fixed_percent = input.float(1.5, "Fixed Percentage", step=0.1, group="Trailing Stop")

// === BACKTEST PERIOD ===
from_year = input.int(2020, "Backtest Start Year", minval=2000)
from_month = input.int(1, "Start Month", minval=1, maxval=12)
from_day = input.int(1, "Start Day", minval=1, maxval=31)
test_period = (time >= timestamp(from_year, from_month, from_day, 0, 0))

// === MULTI-TIMEFRAME TREND CHECK ===
getTrend(tf) =>
c = request.security(syminfo.tickerid, tf, close)
ema21 = request.security(syminfo.tickerid, tf, ta.ema(close, 21))
c > ema21

trend_m1 = getTrend("1")
trend_h4 = getTrend("240")
trend_d1 = getTrend("D")
trend_w1 = getTrend("W")

trend_up = trend_m1 and trend_h4 and trend_d1 and trend_w1
trend_down = not trend_m1 and not trend_h4 and not trend_d1 and not trend_w1
trend_bias = trend_up ? "Bullish" : trend_down ? "Bearish" : "Mixed"

// === RVOL CALCULATION ===
rvol = volume / ta.sma(volume, rvol_length)
rvol_ok = rvol > rvol_threshold

// === RSI & DIVERGENCE CALCULATION ===
rsi = ta.rsi(close, rsi_length)

bullish_div() =>
price_low = ta.lowest(low, div_lookback)
rsi_low = ta.lowest(rsi, div_lookback)
price_low_prev = ta.lowest(low[div_lookback], div_lookback)
rsi_low_prev = ta.lowest(rsi[div_lookback], div_lookback)
rsi_cond = rsi_low > rsi_low_prev and rsi < rsi_oversold
price_cond = price_low < price_low_prev
price_cond and rsi_cond

bearish_div() =>
price_high = ta.highest(high, div_lookback)
rsi_high = ta.highest(rsi, div_lookback)
price_high_prev = ta.highest(high[div_lookback], div_lookback)
rsi_high_prev = ta.highest(rsi[div_lookback], div_lookback)
rsi_cond = rsi_high < rsi_high_prev and rsi > rsi_overbought
price_cond = price_high > price_high_prev
price_cond and rsi_cond

valid_bull_div = use_divergence ? bullish_div() : true
valid_bear_div = use_divergence ? bearish_div() : true

// === OPPOSITE CANDLE ENTRY LOGIC ===
prev_open = open[1]
prev_close = close[1]

bullish_entry = close > open and prev_close < prev_open
bearish_entry = close < open and prev_close > prev_open
entry_signal = (bullish_entry or bearish_entry) and rvol_ok and test_period

// === FIBONACCI LEVEL ===
fib_start = math.min(prev_open, prev_close)
fib_end = math.max(prev_open, prev_close)
fib_786 = fib_start + (fib_end - fib_start) * (fib_level / 100)

// === TRAILING STOP CALCULATION ===
var float trail_stop = na
atr_val = ta.atr(atr_length)
if use_trailing
if bullish_entry
if trail_type == "ATR"
trail_stop := low - atr_val * atr_mult
else
trail_stop := close * (1 - fixed_percent/100)
else if

bearish_entry
if trail_type == "ATR"
trail_stop := high + atr_val * atr_mult
else
trail_stop := close * (1 + fixed_percent/100)

if not na(trail_stop)
if trend_up
trail_stop := math.max(trail_stop, close - atr_val * atr_mult)
else if trend_down
trail_stop := math.min(trail_stop, close + atr_val * atr_mult)

// === ENTRY CONDITIONS WITH REFINEMENTS ===
buy_signal = entry_signal and bullish_entry and trend_up and valid_bull_div
sell_signal = entry_signal and bearish_entry and trend_down and valid_bear_div

// === PLOTTING ===
// Entry signals
plotshape(visual_alert and buy_signal, title="Buy Signal", location=location.belowbar,
style=shape.triangleup, color=color.new(color.green, 0), size=size.small)
plotshape(visual_alert and sell_signal, title="Sell Signal", location=location.abovebar,
style=shape.triangledown, color=color.new(color.red, 0), size=size.small)

// Fib level
plot(show_fib and entry_signal ? fib_786 : na, title="78.6 Fib Level",
style=plot.style_linebr, color=color.orange, linewidth=2)

// Trailing stop
trail_plot = use_trailing and not na(trail_stop) ? trail_stop : na
plot(trail_plot, title="Trailing Stop", color=color.purple, style=plot.style_linebr)

// Trend background
var color neutral = color.new(color.gray, 90)
trend_color = trend_bias == "Bullish" ? color.new(color.green, 90) :
trend_bias == "Bearish" ? color.new(color.red, 90) : neutral
bgcolor(highlight_trend ? trend_color : na)

// RVOL Label
if show_rvol_label and bar_index % 20 == 0
label.new(bar_index, high, "RVOL: " + str.tostring(rvol, "#.00"),
style=label.style_label_left, textcolor=color.white, size=size.small,
color=rvol_ok ? color.green : color.red)

// === ALERT CONDITIONS ===
alertcondition(buy_signal, "BUY Signal Alert",
"MMS PRO BUY at {{close}} on {{ticker}}")
alertcondition(sell_signal, "SELL Signal Alert",
"MMS PRO SELL at {{close}} on {{ticker}}")

// === ALERT TRIGGERS (SOUND + VISUAL) ===
if sound_alert and buy_signal
alert("BUY Signal Triggered at " + str.tostring(close), alert.freq_once_per_bar)
if sound_alert and sell_signal
alert("SELL Signal Triggered at " + str.tostring(close), alert.freq_once_per_bar)