NEW: initial commit
This commit is contained in:
parent
22013943d7
commit
c6dcb26774
4
tradingview/README.md
Normal file
4
tradingview/README.md
Normal file
@ -0,0 +1,4 @@
|
||||
# Strategy for use with tradingview.com
|
||||
|
||||
## macd-rsi.txt
|
||||
Buy when MACD crossover upwards. Sell when RSI exceeds 75. Simple strategy for use with stocks with a long-term uptrend.
|
31
tradingview/macd-rsi.txt
Normal file
31
tradingview/macd-rsi.txt
Normal file
@ -0,0 +1,31 @@
|
||||
//@version=2
|
||||
strategy("MACD-L RSI-S Strategy", overlay=true)
|
||||
|
||||
// Buy when MACD crossover upwards
|
||||
fastLength = input(12)
|
||||
slowlength = input(26)
|
||||
MACDLength = input(9)
|
||||
|
||||
MACD = ema(close, fastLength) - ema(close, slowlength)
|
||||
aMACD = ema(MACD, MACDLength)
|
||||
delta = MACD - aMACD
|
||||
|
||||
if (crossover(delta, 0))
|
||||
strategy.entry("MacdCU", strategy.long, comment="MacdCU")
|
||||
|
||||
// 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.entry("Rsi75", strategy.short, comment="Rsi75")
|
||||
// strategy.close_all(comment = "RsiSE")
|
||||
//plot(strategy.equity, title="equity", color=color.red, linewidth=2, style=plot.style_areabr)
|
||||
|
Loading…
Reference in New Issue
Block a user