Script
Script
ema5 = ta.ema(close, 5)
ema5 = ta.ema(close, 5)
ema5 = ta.ema(close, 5)
// Calculate the difference between close and close of 'fallingCandles' bars ago in 5 min timeframe
falling1 = close - security(syminfo.tickerid, "5", close)[fallingCandles1]
// Calculate the difference between close and close of 'fallingCandles' bars ago in daily timeframe
falling2 = close - security(syminfo.tickerid, "D", close)[fallingCandles2]
// Calculate the difference between close and close of 'upwardCandles_5min' bars ago
upward_5min = close - close[upwardCandles_5min]
// Calculate the difference between close and close of 'upwardCandles_D' bars ago
upward_D = close - security(syminfo.tickerid, "D", close)[upwardCandles_D]
//@version=5
indicator("EMA Strategy", overlay=true)
ema5 = ta.ema(close, 5)
ema20 = ta.ema(close, 20)
//@version=4
strategy("Moving Average Crossover Strategy", overlay=true)
capital = 10000
if (buySignal)
strategy.entry("Buy", strategy.long)
if (sellSignal)
strategy.entry("Sell", strategy.short)
//@version=5
strategy("EMA Strategy", overlay=true)
ema5 = ta.ema(close, 5)
ema20 = ta.ema(close, 20)
// Trading capital
capital = 10000
if (sell_signal)
strategy.entry("Sell", strategy.short)
strategy.exit("Take Profit", "Sell", limit=close * 0.99)
strategy.exit("Stop Loss", "Sell", stop=close * 1.01)