5 Minute Scalp
5 Minute Scalp
5 Minute Scalp
/////////////////////////////////////////
//aetting up rsi
///////////////////////////////////////////
rsilengthlong = input.int(defval = 11, title = "Rsi Length Long", minval = 1)
rlong=ta.rsi(close,rsilengthlong)
rsilengthshort = input.int(defval = 29, title = "Rsi Length Short", minval = 1)
rshort=ta.rsi(close,rsilengthshort)
///////////////////////////
//Only taking long and shorts, if RSI is above 51 or bellow 49
rsilong = rlong >= 51
rsishort = rshort <= 49
//////////////////////////////////////
//only taking trades if all 3 emas are in the correct order
long = out1 > out2 and out2 > out3
short = out1 < out2 and out2 < out3
/////////////////////////////////////
///////////////////////////////////////////
//setting up TP and SL
TP = input.float(defval = 0.5, title = "Take Profit %",step = 0.1) / 100
SL = input.float(defval = 0.3, title = "Stop Loss %", step = 0.1) / 100
if (strategy.position_size>0)
longstop = strategy.position_avg_price * (1-SL)
longprofit = strategy.position_avg_price * (1+TP)
strategy.exit(id ="close
long",from_entry="Long",stop=longstop,limit=longprofit)
if (strategy.position_size<0)
strategy.exit(id ="close short",stop=shortstop,limit=shortprofit)