code-dumps/tradingview/hammer-rsi.txt
2020-07-26 15:32:54 +08:00

29 lines
943 B
Plaintext

//@version=4
strategy("Hammer-L RSI-S Strategy", overlay=true, initial_capital=12000, default_qty_type=strategy.cash, default_qty_value=4000)
// Buy when hammer is observed in a downtrend
//Bullish Hammer Up
bhu1 = close - open > 0 and (close - open) / 3 > high - close and
(open - low) / 2 > close - open and close - open > (open - low) / 8
if bhu1 == true
strategy.entry("HammerLE", strategy.long, comment="HammerLE")
// Sell when RSI exceeds 75
length = input(14)
overSold = input(30)
overBought = input(75)
price = close
vrsi = rsi(price, length)
co = crossover(vrsi, overSold)
cu = crossunder(vrsi, overBought)
if not na(vrsi)
if cu
strategy.close_all(when=open < close)
// strategy.exit(id = "MacdCU", qty_percent = 80, comment = "RsiC80")
// strategy.entry("Rsi75", strategy.short, comment="Rsi75")
//plot(strategy.equity, title="equity", color=color.red, linewidth=2, style=plot.style_areabr)