Magrus

Mix Strategy Magrus LSKBTC 15M

145 0 10
Testing
Remove from Favorite Scripts Add to Favorite Scripts
//@version=2
strategy("Mix Strategy Magrus", overlay=true)
length = input(title="Length", type=integer, minval=1, maxval=1000, defval=1)
price = close

upBound = highest(high, length)
downBound = lowest(low, length)


//RSI
overSold = input( 30 )
overBought = input( 70 )

vrsi = rsi(price, length)

//MA
malong = crossover(sma(close, 10), sma(close, 20))
mashort = crossunder(sma(close, 10), sma(close, 20))

//DMI
len = input(14, minval=1, title="DI Length")
lensig = input(14, title="ADX Smoothing", minval=1, maxval=50)
up = change(high)
down = -change(low)
trur = rma(tr, len)
plus = fixnan(100 * rma(up > down and up > 0 ? up : 0, len) / trur)
minus = fixnan(100 * rma(down > up and down > 0 ? down : 0, len) / trur)
sum = plus + minus 
adxm = 100 * rma(abs(plus - minus) / (sum == 0 ? 1 : sum), lensig)

//DMI END
Balert = malong and (not na(close[length])) and (crossover(vrsi, overSold))
Salert = (minus > plus) and (down)
Salert2 = (mashort) and (minus > plus) and (down)

if malong and (not na(close[length])) and (crossover(vrsi, overSold))
    strategy.entry("ChBrkLE", strategy.long, stop=upBound + syminfo.mintick, comment="Long")
    

if (mashort) and (minus > plus) and (down) or (minus > plus) and (down)
    strategy.entry("MACrossSE", strategy.short, comment="Short") 
    
    
alertcondition(Balert, title='Buying', message='Buy!')
alertcondition(Salert, title='Selling', message='Sell!')
alertcondition(Salert2, title='Selling', message='Sell!')
    

Ideas Scripts Chart
United States
United Kingdom
India
España
Italia
Brasil
Россия
Türkiye
日本
한국
Home Stock Screener Economic Calendar How It Works Chart Features House Rules Moderators For the WEB Widgets Stock Charting Library Priority Support Feature Request Blog & News FAQ Help & Wiki Twitter
Private Messages Chat Ideas Published Followers Following Priority Support Public Profile Profile Settings Account and Billing Sign Out