NEW: added hammer-rsi.txt
This commit is contained in:
parent
6776eb1571
commit
49bff14789
@ -1,4 +1,8 @@
|
|||||||
# Strategy for use with tradingview.com
|
# Strategy for use with tradingview.com
|
||||||
|
|
||||||
## macd-rsi.txt
|
## macd-rsi.txt
|
||||||
Long when MACD crossover upwards. Short when RSI exceeds 75. Simple strategy for use with stocks with a long-term uptrend. I'm still working on the code to not short but only close a portion of previous positions. Can't get strategy.close or strategy.close_all to work.
|
Long when MACD crossover upwards. close all when RSI exceeds 75. Simple strategy for use with stocks with a long-term uptrend.
|
||||||
|
|
||||||
|
## hammer-rsi.txt
|
||||||
|
Long when hammer is observed, close all when RSI exceeds 75. Simple strategy for use with stocks with a long-term uptrend.
|
||||||
|
|
||||||
|
28
tradingview/hammer-rsi.txt
Normal file
28
tradingview/hammer-rsi.txt
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
//@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)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user