RSI Trend Crypto
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © FieryTrading

//@version=4
strategy("RSI Trend Crypto", overlay=false, pyramiding=1, commission_value=0.2, default_qty_type=strategy.percent_of_equity, default_qty_value=100)

// Input
UseEmergency = input(false, "Use Emergency Exit?")
RSIlong = input(35, "RSI Long Cross")
RSIclose = input(75, "RSI Close Position")
Emergencyclose = input(10, "RSI Emergency Close Position")

// RSI
rsi = rsi(close, 14)

// Conditions
long = crossover(rsi, RSIlong)
longclose = crossunder(rsi, RSIclose)
emergency = crossunder(rsi, Emergencyclose)

// Plots
plot(rsi, color=color.white, linewidth=2)
plot(RSIlong, color=color.green)
plot(RSIclose, color=color.red)

// Alert messages 
// When using a bot remember to use "{{strategy.order.alert_message}}" in your alert
// You can edit the alert message freely to suit your needs

LongAlert = 'RSI Long Cross: LONG'
CloseAlert = 'RSI Close Position'
EmergencyAlert = 'RSI Emergency Close'

// Strategy
if long
    strategy.entry("Long", strategy.long, alert_message=LongAlert)

if longclose
    strategy.close("Long", alert_message=CloseAlert)

if emergency and UseEmergency==true
    strategy.close("Long", alert_message=EmergencyAlert)









