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

BTC Ema Crossover (Rsi+adx)

The document outlines a trading strategy for Bitcoin using a combination of technical indicators including RSI, ADX, and EMAs. It defines specific parameters for buy and sell signals, as well as stop-loss and target levels based on ATR. The strategy aims to achieve a high win rate by employing enhanced signal logic and plotting relevant indicators on a trading chart.

Uploaded by

Himank Sharma
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)
123 views2 pages

BTC Ema Crossover (Rsi+adx)

The document outlines a trading strategy for Bitcoin using a combination of technical indicators including RSI, ADX, and EMAs. It defines specific parameters for buy and sell signals, as well as stop-loss and target levels based on ATR. The strategy aims to achieve a high win rate by employing enhanced signal logic and plotting relevant indicators on a trading chart.

Uploaded by

Himank Sharma
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

strategy("Scalper's Edge BTC Strategy - High Win Rate", overlay=true)

// Inputs
rsiPeriod = input.int(7, "RSI Period", minval=1)
rsiOverbought = input.int(70, "RSI Overbought", minval=1)
rsiOversold = input.int(30, "RSI Oversold", minval=1)
adxPeriod = input.int(14, "ADX Period", minval=1)
adxThreshold = input.int(30, "ADX Threshold", minval=1) // Increased from 25 to 30
emaFastPeriod = input.int(5, "EMA Fast Period", minval=1)
emaSlowPeriod = input.int(21, "EMA Slow Period", minval=1)
emaTrendPeriod = input.int(50, "EMA Trend Period", minval=1) // Added trend EMA
atrPeriod = input.int(14, "ATR Period", minval=1)
targetMultiplier = input.float(1.5, "Target Multiplier (Risk:Reward)",
minval=1.0) // Reduced from 2.0 to 1.5

// Calculations
// RSI
rsi = ta.rsi(close, rsiPeriod)
rsiRising = rsi > rsi[1] // RSI increasing for buy confirmation
rsiFalling = rsi < rsi[1] // RSI decreasing for sell confirmation

// Manual ADX Calculation


tr = ta.tr(true)
plusDM = high - high[1] > low[1] - low ? math.max(high - high[1], 0) : 0
minusDM = low[1] - low > high - high[1] ? math.max(low[1] - low, 0) : 0
trSmooth = ta.rma(tr, adxPeriod)
plusDMSmooth = ta.rma(plusDM, adxPeriod)
minusDMSmooth = ta.rma(minusDM, adxPeriod)
plusDI = 100 * plusDMSmooth / trSmooth
minusDI = 100 * minusDMSmooth / trSmooth
dx = 100 * math.abs(plusDI - minusDI) / (plusDI + minusDI)
adx = ta.rma(dx, adxPeriod)

// EMAs
emaFast = ta.ema(close, emaFastPeriod)
emaSlow = ta.ema(close, emaSlowPeriod)
emaTrend = ta.ema(close, emaTrendPeriod) // Trend filter

// ATR for SL and Targets


atr = ta.atr(atrPeriod)

// Enhanced Signal Logic


buySignal = ta.crossover(emaFast, emaSlow) and rsi > rsiOversold and rsi <
rsiOverbought and adx > adxThreshold and close > emaTrend and rsiRising
sellSignal = ta.crossunder(emaFast, emaSlow) and rsi < rsiOverbought and rsi >
rsiOversold and adx > adxThreshold and close < emaTrend and rsiFalling

// Stop-Loss and Target Levels


var float buySL = na
var float buyTarget = na
var float sellSL = na
var float sellTarget = na

if buySignal
buySL := low - atr
buyTarget := close + (close - buySL) * targetMultiplier

if sellSignal
sellSL := high + atr
sellTarget := close - (sellSL - close) * targetMultiplier

// Strategy Execution (Non-repainting)


buyEntry = ta.crossover(emaFast[1], emaSlow[1]) and rsi[1] > rsiOversold and rsi[1]
< rsiOverbought and adx[1] > adxThreshold and close[1] > emaTrend[1] and
rsiRising[1]
sellEntry = ta.crossunder(emaFast[1], emaSlow[1]) and rsi[1] < rsiOverbought and
rsi[1] > rsiOversold and adx[1] > adxThreshold and close[1] < emaTrend[1] and
rsiFalling[1]

if buyEntry
strategy.entry("Long", strategy.long)
strategy.exit("Exit Long", "Long", stop=buySL, profit=buyTarget)

if sellEntry
strategy.entry("Short", strategy.short)
strategy.exit("Exit Short", "Short", stop=sellSL, profit=sellTarget)

// Plot Signals
plotshape(buySignal, title="Buy Signal", location=location.belowbar,
color=color.green, style=shape.triangleup, size=size.small)
plotshape(sellSignal, title="Sell Signal", location=location.abovebar,
color=color.red, style=shape.triangledown, size=size.small)

// Plot EMAs
plot(emaFast, "EMA Fast", color=color.green, linewidth=2)
plot(emaSlow, "EMA Slow", color=color.red, linewidth=2)
plot(emaTrend, "EMA Trend", color=color.blue, linewidth=1) // Added trend EMA plot

// Plot SL and Targets


plot(buySL, "Buy SL", color=color.red, style=plot.style_cross, linewidth=1,
trackprice=true)
plot(buyTarget, "Buy Target", color=color.green, style=plot.style_cross,
linewidth=1, trackprice=true)
plot(sellSL, "Sell SL", color=color.red, style=plot.style_cross, linewidth=1,
trackprice=true)
plot(sellTarget, "Sell Target", color=color.green, style=plot.style_cross,
linewidth=1, trackprice=true)

// Debug Plots (Optional)


// plot(rsi, "RSI", color=color.blue, display=display.bottom)
// plot(adx, "ADX", color=color.orange, display=display.bottom)

You might also like