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)