UDAY_C_Santhakumar

TSM Donchian Moving Average System_by_ucsgears

This is just the raw code for the system / strategies.

Will Complete this when I get more time.

Green - Setup Long
Red - Setup Short

Uday C Santhakumar
开源脚本

本着真正的TradingView精神,该脚本的作者将其开源发布,以便交易者可以理解和验证它。为作者喝彩!您可以免费使用它,但在出版物中重复使用此代码受网站规则的约束。 您可以收藏它以在图表上使用。

免责声明

这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。

想在图表上使用此脚本?
study("TSM Donchian Moving Average System", overlay = true)

a = input(20, title = "Long Period")
b = input(5, title = "Short Period")
ca = input(1, title = "Band Factor")

// Moving average
malong = sma(close,a)
mashort = sma(close,b)
range = sma(tr, a)*ca
kclupper = malong + range
kcllower = malong - range

kcsupper = mashort + range
kcslower = mashort - range


// PLOT
plot(malong, offset=1, title = "SMA Long")
plot(mashort, offset=1, title = "SMA Short")
plot(kclupper, offset=1, title = "KC Upper")
plot(kcllower, offset=1, title = "KC Lower")

// SETUP 
// LONG 
setuplong = close > kclupper[1] and close > kcsupper[1] ? green : na
setupshort = close < kcllower[1] and close < kcslower[1] ? red : na

barcolor(setuplong)
barcolor(setupshort)

// EXIT
// LONG
//exitlong = close < kclupper[1] and close < kcsupper[1] ? blue : na
//exitshort = close > kcllower[1] and close > kcslower[1] ? orange : na

//barcolor(exitlong)
//barcolor(exitshort)