RicardoSantos

[RS]Convergence Divergence Impulse Counter V0

EXPERIMENTAL:
Counts the number of impulses with the same direction within a larger trend.
สคริปต์โอเพนซอร์ซ

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

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

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

ต้องการที่จะใช้สคริปต์นี้บนชาร์ตใช่ไหม?
study(title='[RS]Convergence Divergence Impulse Counter V0', shorttitle='CDIC', overlay=false)
length01 = input(20)
length02 = input(100)
src = input(close)
ma01 = ema(src, length01)
ma02 = ema(src, length02)

cd01 = src - ma01
cd02 = ma01 - ma02

imp = src > ma01 and ma01 > ma02 ? cd01 : src < ma01 and ma01 < ma02 ? cd01 : 0
count = na(count[1]) ? 0 :
        change(crossover(cd02, 0)) > 0 ? 1 :
        change(crossunder(cd02, 0)) > 0 ? -1 :
        count[1] > 0 and change(crossover(cd01, 0)) > 0 ? count[1] + 1 :
        count[1] < 0 and change(crossunder(cd01, 0)) > 0 ? count[1] - 1 :
        count[1]

//plot(series=imp, color=black, style=columns)
//plot(series=cross(cd02, 0) ? 0 : na, color=color(aqua, 0), style=circles, linewidth=4)
plot(series=count, color=black, style=columns)
hline(0)