RicardoSantos

[RS]JR Flex Donchian Channel V0R1

Experimental:
Request for JR, fixed some stuff...
erroneous functions using highest() when it should be lowest()
missing midline...
סקריפט קוד פתוח

ברוח TradingView אמיתית, מחבר הסקריפט הזה פרסם אותו בקוד פתוח, כך שסוחרים יכולים להבין ולאמת אותו. כל הכבוד למחבר! אתה יכול להשתמש בו בחינם, אך שימוש חוזר בקוד זה בפרסום כפוף לכללי הבית. אתה יכול להכניס אותו למועדפים כדי להשתמש בו בגרף.

כתב ויתור

המידע והפרסומים אינם אמורים להיות, ואינם מהווים, עצות פיננסיות, השקעות, מסחר או סוגים אחרים של עצות או המלצות שסופקו או מאושרים על ידי TradingView. קרא עוד בתנאים וההגבלות.

רוצה להשתמש בסקריפ זה בגרף?
study("[RS]JR Flex Donchian Channel V0R1", overlay=true)
BB_Length = input(title='BB Length', type=integer, defval=10)
BB_Deviations = input(title='BB Deviations', type=integer, defval=2)
BB_Src = input(title='Source', type=source, defval=close)
//  ||---   BB
BB_Midline = sma(BB_Src, BB_Length)
BB_Deviation = stdev(BB_Src, BB_Length) * BB_Deviations
BB_Upper = BB_Midline + BB_Deviation
BB_Lower = BB_Midline - BB_Deviation
//  ||---   BBW
BB_Width = ((BB_Upper-BB_Lower) / BB_Midline)
//  ||---   DC
DC_Upper = BB_Width <= .025 ? highest(49) :
        BB_Width > .025 and BB_Width <= .050 ? highest(40) :
        BB_Width > .050 and BB_Width <= .075 ? highest(30) :
        BB_Width > .075 and BB_Width <= .100 ? highest(20) :
        BB_Width > .100 and BB_Width <= .125 ? highest(10) :
        BB_Width > .125 and BB_Width <= .150 ? highest(7) :
        BB_Width > .150 ? highest(3) : highest(2)

DC_Lower = BB_Width <= .025 ? lowest(49) :
        BB_Width > .025 and BB_Width <= .050 ? lowest(40) :
        BB_Width > .050 and BB_Width <= .075 ? lowest(30) :
        BB_Width > .075 and BB_Width <= .100 ? lowest(20) :
        BB_Width > .100 and BB_Width <= .125 ? lowest(10) :
        BB_Width > .125 and BB_Width <= .150 ? lowest(7) :
        BB_Width > .150 ? lowest(3) : lowest(2)

pU = plot(DC_Upper, color=blue)
pL = plot(DC_Lower, color=blue)
pM = plot(avg(DC_Upper, DC_Lower), color=black)
fill(pU, pM, color=olive, transp=70)
fill(pL, pM, color=orange, transp=70)