NEW: initial commit

This commit is contained in:
xpk 2020-07-26 13:33:27 +08:00
parent 22013943d7
commit c6dcb26774
Signed by: xpk
GPG Key ID: CD4FF6793F09AB86
2 changed files with 35 additions and 0 deletions

4
tradingview/README.md Normal file
View 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
View 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)