TraderSkyr

DP's Countertrend Indicator

Shows your potential profit by going short(red)/long(green) against the current trend, use with you favorite entry/exit method for maximum effect, can be adjusted for share cost and commission.
สคริปต์โอเพนซอร์ซ

ด้วยจิตวิญญาณของ TradingView อย่างแท้จริง ผู้เขียนสคริปต์นี้ได้เผยแพร่เป็นโอเพนซอร์ส เพื่อให้ผู้ค้าสามารถเข้าใจและตรวจสอบได้ ไชโยให้กับผู้เขียน! คุณสามารถใช้ได้ฟรี แต่การใช้รหัสนี้ซ้ำในสิ่งพิมพ์อยู่ภายใต้กฎระเบียบการใช้งาน คุณสามารถตั้งเป็นรายการโปรดเพื่อใช้บนชาร์ตได้

คำจำกัดสิทธิ์ความรับผิดชอบ

ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมที่ เงื่อนไขการใช้บริการ

ต้องการที่จะใช้สคริปต์นี้บนชาร์ตใช่ไหม?
//Shows your potential profit by going short(red)/long(green) against the current trend, use with you favorite entry/exit method for maximum effect, 
//can be adjusted for share cost and commission.

study(shorttitle = "DP_CTI", title="DP's Countertrend Indicator")
MA = input(120, minval=1, title = "Moving Avg Length")
source = close
mg = na(mg[1]) ? ema(source, MA) : mg[1] + (source - mg[1]) / (MA * pow(source/mg[1], 4))
Bars = input(30,title="Lookback Bars")
Cost = input(0,type = float,title = "Per Share Cost $")
Comm = input(0, type = float, title = "Per Share Commission $")

BullR = highest(close,Bars)-ohlc4
BearR = ohlc4-lowest(close,Bars)
BullT = iff(high<mg,mg,close + BullR)
BearT = iff(low>mg,mg,close - BearR)

BuC = iff(BullT-close-(Cost+Comm)>0,green,lime)
BeC = iff(close-BearT-(Cost+Comm)>0,maroon,red)

Hull = wma(2*wma(source, MA/2)-wma(source, MA), round(sqrt(MA)))


plot((BullT-close)-(Cost+Comm), color=BuC, style=histogram, linewidth = 2, trackprice = false)
plot((close-BearT)-(Cost+Comm), color=BeC, style=histogram, linewidth = 2, trackprice = false)