Magrus

Mix Strategy Magrus LSKBTC 15M

172 0 13
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!')
    

United States
United Kingdom
India
Deutschland
España
France
Việt Nam
Italia
Polska
Brasil
Россия
Türkiye
Indonesia
Malaysia
日本
한국
简体
繁體
Home Stock Screener Forex Signal Finder Cryptocurrency Signal Finder Economic Calendar How It Works Chart Features House Rules Moderators Website & Broker Solutions Widgets Stock Charting Library Priority Support Feature Request Blog & News FAQ Help & Wiki Twitter
Profile Profile Settings Account and Billing Priority Support Ideas Published Followers Following Private Messages Chat Sign Out