Short Selling EMA Cross (By Coinrule)
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Coinrule

//@version=5
strategy("Short Selling EMA Cross (By Coinrule)", overlay=true, initial_capital = 10000, default_qty_value = 30, default_qty_type = strategy.percent_of_equity, commission_type=strategy.commission.percent, commission_value=0.1)

// EMAs 
fastEMA = ta.ema(close, 20)
slowEMA = ta.ema(close, 50)

// Conditions
goShortCondition1 = ta.crossunder(fastEMA, slowEMA)

timePeriod = time >= timestamp(syminfo.timezone, 2021, 12, 1, 0, 0)
notInTrade = strategy.position_size <= 0
strategyDirection = strategy.direction.short

if (goShortCondition1 and timePeriod and notInTrade)
    stopLoss = high * 1.16
    takeProfit = low * 0.92
    strategy.entry("short", strategy.short)
    strategy.exit("exit","short", stop=stopLoss, limit=takeProfit)
    
plot(fastEMA, color=color.blue)
plot(slowEMA, color=color.yellow)


