//@version=3 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 // Detect downtrend is_DownTrend = false // sma100 = sma(close, 100) sma50 = sma(close, 50) // is_DownTrend := close < sma50 and sma50 < sma100 is_DownTrend := close < sma50 // Detect hammer len_upShadow = high - max(open,close) len_downShadow = min(open,close) - low len_body = abs(open - close) if is_DownTrend and len_downShadow > 0 if len_upShadow < len_downShadow / 5 and len_body < len_downShadow / 3 strategy.entry("HammerL", strategy.long, comment="HammerL") // 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)