Indeks Nifty 50
Panjang

My new parash

//version=5
strategy("Nifty 15-Min Intraday Strategy", overlay=true, margin_long=100, margin_short=100)

// Inputs
emaLength = input.int(20, "EMA Length")
rsiLength = input.int(14, "RSI Length")
stopLossPoints = input.int(15, "Stop Loss (Points)")
takeProfitPoints = input.int(30, "Take Profit (Points)")
useTimeFilter = input.bool(true, "Restrict Trading Hours (9:45-14:30 IST)")

// Calculate Indicators
ema20 = ta.ema(close, emaLength)
rsi = ta.rsi(close, rsiLength)
volumeUp = volume > ta.sma(volume, 5)

// Define Trading Session (9:45 AM to 2:30 PM IST)
timeAllowed = time(timeframe.period, "0945-1430")

// Trend Identification
bullishTrend = close > ema20
bearishTrend = close < ema20

// Entry Conditions
longCondition =
bullishTrend and
ta.crossover(rsi, 50) and
(low <= ema20) and
volumeUp and
(useTimeFilter ? timeAllowed : true)

shortCondition =
bearishTrend and
ta.crossunder(rsi, 50) and
(high >= ema20) and
volumeUp and
(useTimeFilter ? timeAllowed : true)

// Execute Trades
if (longCondition)
strategy.entry("Long", strategy.long)
strategy.exit("Exit Long", "Long", stop=close - stopLossPoints, limit=close + takeProfitPoints)

if (shortCondition)
strategy.entry("Short", strategy.short)
strategy.exit("Exit Short", "Short", stop=close + stopLossPoints, limit=close - takeProfitPoints)

// Plotting
plot(ema20, color=color.blue, title="20 EMA")
bgcolor(bullishTrend ? color.new(color.green, 90) : color.new(color.red, 90))

// Alerts
alertcondition(longCondition, "Long Entry", "Nifty Long Signal on 15-min")
alertcondition(shortCondition, "Short Entry", "Nifty Short Signal on 15-min")

Penafian