Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
157 changes: 157 additions & 0 deletions links/common.pine.link
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ SMA40 = ta.sma(close, 40)
plot(SMA40, title='SMA40')
SMA50 = ta.sma(close, 50)
plot(SMA50, title='SMA50')

SMA75 = ta.sma(close, 75)
plot(SMA75, title='SMA75')
SMA100 = ta.sma(close, 100)
Expand Down Expand Up @@ -120,6 +121,12 @@ plot(RSI21[1], title='RSI21[1]')
ATR = ta.rma(ta.tr(true), 14)
plot(ATR, title='ATR')

ATR := ta.rma(ta.tr(true), 20)
plot(ATR, title='ATR20')

ATR := ta.rma(ta.tr(true), 1)
plot(ATR, title='ATR1')

// Average True Range Percent (ATRP)
plot(ATR / close * 100, title='ATRP')

Expand Down Expand Up @@ -199,6 +206,10 @@ Mom14 = close - close[14]
plot(Mom14, title='Mom_14')
plot(Mom14[1], title='Mom_14[1]')

Mom80 = close - close[80]
plot(Mom80, title='Mom_80')
plot(Mom80[1], title='Mom_80[1]')

// study(title="Stochastic", shorttitle="Stoch")
lengthStoch = 14
smoothKStoch = 3
Expand All @@ -216,6 +227,38 @@ plot(dStoch_14_1_3, title='Stoch.D_14_1_3')
plot(kStoch_14_1_3[1], title='Stoch.K[1]_14_1_3')
plot(dStoch_14_1_3[1], title='Stoch.D[1]_14_1_3')

lengthStoch := 5
smoothKStoch := 3
smoothDStoch := 3
kStoch_5_1_3 = ta.stoch(close, high, low, lengthStoch)
kStoch := ta.sma(kStoch_5_1_3, smoothKStoch)
dStoch := ta.sma(kStoch, smoothDStoch)
plot(kStoch, title='Stoch5.K')
plot(dStoch, title='Stoch5.D')
plot(kStoch[1], title='Stoch5.K[1]')
plot(dStoch[1], title='Stoch5.D[1]')
dStoch_5_1_3 = ta.sma(kStoch_5_1_3, smoothDStoch)
plot(kStoch_5_1_3, title='Stoch5.K_5_1_3')
plot(dStoch_5_1_3, title='Stoch5.D_5_1_3')
plot(kStoch_5_1_3[1], title='Stoch5.K[1]_5_1_3')
plot(dStoch_5_1_3[1], title='Stoch5.D[1]_5_1_3')

lengthStoch := 9
smoothKStoch := 3
smoothDStoch := 3
kStoch_9_1_3 = ta.stoch(close, high, low, lengthStoch)
kStoch := ta.sma(kStoch_9_1_3, smoothKStoch)
dStoch := ta.sma(kStoch, smoothDStoch)
plot(kStoch, title='Stoch9.K')
plot(dStoch, title='Stoch9.D')
plot(kStoch[1], title='Stoch9.K[1]')
plot(dStoch[1], title='Stoch9.D[1]')
dStoch_9_1_3 = ta.sma(kStoch_9_1_3, smoothDStoch)
plot(kStoch_9_1_3, title='Stoch9.K_5_1_3')
plot(dStoch_9_1_3, title='Stoch9.D_5_1_3')
plot(kStoch_9_1_3[1], title='Stoch9.K[1]_5_1_3')
plot(dStoch_9_1_3[1], title='Stoch9.D[1]_5_1_3')

// average volume
AvgVol = ta.sma(volume, 10)
plot(AvgVol, title='average_volume_10d_calc')
Expand All @@ -229,6 +272,22 @@ CCI = ta.cci(hlc3, 20)
plot(CCI, title='CCI20')
plot(CCI[1], title='CCI20[1]')

CCI := ta.cci(close, 20)
plot(CCI, title='CCCI20')
plot(CCI[1], title='CCCI20[1]')

CCI := ta.cci(close, 7)
plot(CCI, title='CCCI7')
plot(CCI[1], title='CCCI7[1]')

CCI := ta.cci(hlc3, 14)
plot(CCI, title='CCI14')
plot(CCI[1], title='CCI14[1]')

CCI := ta.cci(hlc3, 100)
plot(CCI, title='CCI100')
plot(CCI[1], title='CCI100[1]')

// Donchian Channels
donchLen = 20
donchUpper = ta.highest(donchLen)
Expand All @@ -237,13 +296,83 @@ plot(donchLower, title='DonchCh20.Lower')
plot(donchUpper, title='DonchCh20.Upper')
plot(math.avg(donchUpper, donchLower), title='DonchCh20.Middle')

donchLen := 96
donchUpper := ta.highest(donchLen)
donchLower := ta.lowest(donchLen)
plot(donchLower, title='DonchCh96.Lower')
plot(donchUpper, title='DonchCh96.Upper')
plot(math.avg(donchUpper, donchLower), title='DonchCh96.Middle')

donchLen := 13
donchUpper := ta.highest(donchLen)
donchLower := ta.lowest(donchLen)
plot(donchLower, title='DonchCh13.Lower')
plot(donchUpper, title='DonchCh13.Upper')
plot(math.avg(donchUpper, donchLower), title='DonchCh13.Middle')

donchLen := 10
donchUpper := ta.highest(donchLen)
donchLower := ta.lowest(donchLen)
plot(donchLower, title='DonchCh10.Lower')
plot(donchUpper, title='DonchCh10.Upper')
plot(math.avg(donchUpper, donchLower), title='DonchCh10.Middle')

donchLen := 1
donchUpper := ta.highest(donchLen)
donchLower := ta.lowest(donchLen)
plot(donchLower, title='DonchCh1.Lower')
plot(donchUpper, title='DonchCh1.Upper')
plot(math.avg(donchUpper, donchLower), title='DonchCh1.Middle')

// Hull Moving Average
hullMALength = 9
hullMA_n2ma = 2 * ta.wma(close, hullMALength / 2)
hullMA_nma = ta.wma(close, hullMALength)
HullMA9 = ta.wma(hullMA_n2ma - hullMA_nma, math.floor(math.sqrt(hullMALength)))
plot(HullMA9, title='HullMA9')

hullMALength := 200
hullMA_n2ma := 2 * ta.wma(close, hullMALength / 2)
hullMA_nma := ta.wma(close, hullMALength)
HullMA200 = ta.wma(hullMA_n2ma - hullMA_nma, math.floor(math.sqrt(hullMALength)))
plot(HullMA200, title='HullMA200')

hullMALength := 1728
hullMA_n2ma := 2 * ta.wma(close, hullMALength / 2)
hullMA_nma := ta.wma(close, hullMALength)
HullMA1728 = ta.wma(hullMA_n2ma - hullMA_nma, math.floor(math.sqrt(hullMALength)))
plot(HullMA1728, title='HullMA1728')

hullMALength := 50
hullMA_n2ma := 2 * ta.wma(close, hullMALength / 2)
hullMA_nma := ta.wma(close, hullMALength)
HullMA50 = ta.wma(hullMA_n2ma - hullMA_nma, math.floor(math.sqrt(hullMALength)))
plot(HullMA50, title='HullMA50')

hullMALength := 100
hullMA_n2ma := 2 * ta.wma(close, hullMALength / 2)
hullMA_nma := ta.wma(close, hullMALength)
HullMA100 = ta.wma(hullMA_n2ma - hullMA_nma, math.floor(math.sqrt(hullMALength)))
plot(HullMA100, title='HullMA100')

hullMALength := 20
hullMA_n2ma := 2 * ta.wma(close, hullMALength / 2)
hullMA_nma := ta.wma(close, hullMALength)
HullMA20 = ta.wma(hullMA_n2ma - hullMA_nma, math.floor(math.sqrt(hullMALength)))
plot(HullMA20, title='HullMA20')

hullMALength := 144
hullMA_n2ma := 2 * ta.wma(close, hullMALength / 2)
hullMA_nma := ta.wma(close, hullMALength)
HullMA144 = ta.wma(hullMA_n2ma - hullMA_nma, math.floor(math.sqrt(hullMALength)))
plot(HullMA144, title='HullMA144')

hullMALength := 256
hullMA_n2ma := 2 * ta.wma(close, hullMALength / 2)
hullMA_nma := ta.wma(close, hullMALength)
HullMA256 = ta.wma(hullMA_n2ma - hullMA_nma, math.floor(math.sqrt(hullMALength)))
plot(HullMA256, title='HullMA256')

// Awesome Oscillator
AO = ta.sma(hl2, 5) - ta.sma(hl2, 34)
plot(AO, title='AO')
Expand All @@ -255,6 +384,10 @@ Aroon_length = 14
plot(100 * (ta.highestbars(high, Aroon_length + 1) + Aroon_length) / Aroon_length, title='Aroon.Up')
plot(100 * (ta.lowestbars(low, Aroon_length + 1) + Aroon_length) / Aroon_length, title='Aroon.Down')

Aroon_length := 25
plot(100 * (ta.highestbars(high, Aroon_length + 1) + Aroon_length) / Aroon_length, title='Aroon25.Up')
plot(100 * (ta.lowestbars(low, Aroon_length + 1) + Aroon_length) / Aroon_length, title='Aroon25.Down')

// value traded (dollar volume)
plot(volume * close * syminfo.pointvalue, title='Value.Traded')

Expand All @@ -274,6 +407,9 @@ plot(PSAR, title='P.SAR')
lenMF = 14
plot(ta.mfi(hlc3, lenMF), title='MoneyFlow')

lenMF := 12
plot(ta.mfi(hlc3, lenMF), title='MoneyFlow12')

// study("My Chaikin Money Flow")
lenCMF = 20
accdistRaw = not(close == low and close == high or high == low) ? (close - low - (high - close)) / (high - low) * volume : 0
Expand All @@ -291,8 +427,23 @@ highest = ta.highest(high, WR_period)
WR = (highest - close) / (highest - ta.lowest(low, WR_period)) * -100
plot(WR, title='W.R')

WR_period := 10
highest := ta.highest(high, WR_period)
WR := (highest - close) / (highest - ta.lowest(low, WR_period)) * -100
plot(WR, title='W.R14')

WR_period := 12
highest := ta.highest(high, WR_period)
WR := (highest - close) / (highest - ta.lowest(low, WR_period)) * -100
plot(WR, title='W.R12')

// Rate Of Change (ROC)
plot(ta.roc(close, 9), title='ROC')
plot(ta.roc(close, 1), title='ROC1')
plot(ta.roc(close, 14), title='ROC14')
plot(ta.roc(close, 2), title='ROC2')
plot(ta.roc(close, 12), title='ROC12')


// Bull / Bear Power
BullPower = high - EMA13
Expand Down Expand Up @@ -350,6 +501,12 @@ plot(IC_Lead2_20_60_120_30[IC_displacement], title='Ichimoku.Lead2_20_60_120_30'
VWMA = ta.vwma(close, 20)
plot(VWMA, title='VWMA')

VWMA := ta.vwma(close, 200)
plot(VWMA, title='VWMA200')

VWMA := ta.vwma(close, 50)
plot(VWMA, title='VWMA50')

// Average Day Range (ADR)
smaHigh = ta.sma(high, 14)
smaLow = ta.sma(low, 14)
Expand Down
2 changes: 1 addition & 1 deletion scanner.data.bonds.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{
"id": "text",
"type": "text",
"defval": "i:#1+1~low@$0*time@$0~s2:ifelif_(#0==0){na():f+$1!na():f}elif(#0==1){low!time/1000}_{#0~#0+1~v:if(!na(low@$7)){$6=$6-1~}~0~v:for(0;$6;1){v:if(low@$10\u003clow@$9){$9=$10~}~}~low@$9!time@$9/1000};i:#1+1~high@$0*time@$0~s2:ifelif_(#0==0){na():f+$1!na():f}elif(#0==1){high!time/1000}_{#0~#0+1~v:if(!na(high@$7)){$6=$6-1~}~0~v:for(0;$6;1){v:if(high@$10\u003ehigh@$9){$9=$10~}~}~high@$9!time@$9/1000};0*time@#1~min(n,#1)~0~if_(time\u003c#0){i:0}_{v:for(0;9;1){$0=ceil(($2+$1)/2)~v:ifelif_($2==$1){break~}elif(time@$0\u003c#0){$1=$0~continue~}elif(time@$0\u003e#0){$2=$0~continue~}_{break~}~}~$0};#0~v:if(n==0){$0=365~}~if_($0==0){na():f}_{sum(((high-low)/abs(low))*100/$0,$0)~if_(#0==0){na():f}_{$3}};if_(#0\u003c0\u0026\u0026close\u003e0){na():f}_{(close-#0)*100/abs(#0)};open@#1*0+#0==0?na():f:$4(open@#0);v^open~year~v:if(year\u003e$1@1){$0=open~}~$4($0);close~$0;v^high~v^time/1000~v^low~v:if(high\u003e$0){$0=high~$1=time/1000~$2=low~}~v:if(low\u003c$2){$2=low~}~$0~$1~$0~$1~$2~v^low~v^time/1000~v:if(low\u003c$10){$10=low~$11=time/1000~}~$10~$11~$10~$11~v^open~timenow-315532800000~$2($18,i:3652)~timenow-157766400000~$2($20,i:1826)~timenow-94608000000~$2($22,i:1095)~timenow-31449600000~$2($24,i:364)~s2:$0($25,i:364):s2~s2:$1($25,i:364):s2~timenow-15552000000~$2($30,i:180)~s2:$0($31,i:180):s2~s2:$1($31,i:180):s2~timenow-7776000000~$2($36,i:90)~s2:$0($37,i:90):s2~s2:$1($37,i:90):s2~time-2592000000~timenow-2592000000~$2($43,i:30)~$2($42,i:30)~s2:$0($44,i:30):s2~s2:$1($44,i:30):s2~timenow-604800000~time-604800000~$2($50,i:7)~$2($51,i:7)~s2:$0($52,i:7):s2~s2:$1($52,i:7):s2~$3($53)~$3($45)~tr(1.0)*100/abs(low)~v^time/1000~timenow-31536000000~$2($62,i:365)~$6()~((close-open@4)/open@4)*100~$5($52,i:7)~$5($44,i:30)~$5($37,i:90)~$5($31,i:180)~$5($63,i:365)~$5($23,i:1095)~$5($21,i:1826)~$5($19,i:3652)~time_tradingday/1000~#0~$75~$76-$76@1~na():f~v:if(!($76@1\u003c0)\u0026\u0026!($76\u003c0)){$78=($77/$76@1)*100~}~$78~timenow-86400000~$2($81,i:1)~v:max_bars_back(close,365):v~close@$82~close@$44~close@$63~$5!$6!$7!$8!$9!$13!$14!$15!$16!$17!$26!$27!$28!$29!$32!$33!$34!$35!$38!$39!$40!$41!$46!$47!$48!$49!$54!$56!$58!$59!$60!$61!$65!$66!$67!$68!$69!$70!$71!$72!$73!$64!$74!$76!$77!$80!$84!$85!$86;t:str.substring(ticker,0,str.length(ticker):i-1):t~t:sc(t:syminfo.prefix,t:':',t:$9):t~i:na():f~sym($10,period,period,0,0,1,'NONE',0,0,$11)|$7()|s49:$8($13):s49~$15!$16!$17!$18!$19!$20!$21!$22!$23!$24!$25!$26!$27!$28!$29!$30!$31!$32!$33!$34!$35!$36!$37!$38!$39!$40!$41!$42!$43!$44!$45!$46!$47!$48!$49!$50!$51!$52!$53!$54!$55!$56!$57!$58!$59!$60!$61!$62!$63",
"defval": "i:#1+1~low@$0*time@$0~s2:ifelif_(#0==0){na():f+$1!na():f}elif(#0==1){low!time/1000}_{#0~#0+1~v:if(!na(low@$7)){$6=$6-1~}~0~v:for(0;$6;1){v:if(low@$10\u003clow@$9){$9=$10~}~}~low@$9!time@$9/1000};i:#1+1~high@$0*time@$0~s2:ifelif_(#0==0){na():f+$1!na():f}elif(#0==1){high!time/1000}_{#0~#0+1~v:if(!na(high@$7)){$6=$6-1~}~0~v:for(0;$6;1){v:if(high@$10\u003ehigh@$9){$9=$10~}~}~high@$9!time@$9/1000};0*time@#1~min(n,#1)~0~if_(time\u003c#0){i:0}_{v:for(0;9;1){$0=ceil(($2+$1)/2)~v:ifelif_($2==$1){break~}elif(time@$0\u003c#0){$1=$0~continue~}elif(time@$0\u003e#0){$2=$0~continue~}_{break~}~}~$0};#0~v:if(n==0){$0=365~}~if_($0==0){na():f}_{sum(((high-low)/abs(low))*100/$0,$0)~if_(#0==0){na():f}_{$3}};if_(#0\u003c0\u0026\u0026close\u003e0){na():f}_{(close-#0)*100/abs(#0)};open@#1*0+#0==0?na():f:$4(open@#0);v^open~year~v:if(year\u003e$1@1){$0=open~}~$4($0);close~$0;$7();v^high~v^time/1000~v^low~v:if(high\u003e$0){$0=high~$1=time/1000~$2=low~}~v:if(low\u003c$2){$2=low~}~$0~$1~$0~$1~$2~v^low~v^time/1000~v:if(low\u003c$10){$10=low~$11=time/1000~}~$10~$11~$10~$11~v^open~timenow-315532800000~$2($18,i:3652)~timenow-157766400000~$2($20,i:1826)~timenow-94608000000~$2($22,i:1095)~timenow-31449600000~$2($24,i:364)~s2:$0($25,i:364):s2~s2:$1($25,i:364):s2~timenow-15552000000~$2($30,i:180)~s2:$0($31,i:180):s2~s2:$1($31,i:180):s2~timenow-7776000000~$2($36,i:90)~s2:$0($37,i:90):s2~s2:$1($37,i:90):s2~time-2592000000~timenow-2592000000~$2($43,i:30)~$2($42,i:30)~s2:$0($44,i:30):s2~s2:$1($44,i:30):s2~timenow-604800000~time-604800000~$2($50,i:7)~$2($51,i:7)~s2:$0($52,i:7):s2~s2:$1($52,i:7):s2~$3($53)~$3($45)~tr(1.0)*100/abs(low)~v^time/1000~timenow-31536000000~$2($62,i:365)~$6()~((close-open@4)/open@4)*100~$5($52,i:7)~$5($44,i:30)~$5($37,i:90)~$5($31,i:180)~$5($63,i:365)~$5($23,i:1095)~$5($21,i:1826)~$5($19,i:3652)~time_tradingday/1000~#0~$75~$76-$76@1~na():f~v:if(!($76@1\u003c0)\u0026\u0026!($76\u003c0)){$78=($77/$76@1)*100~}~$78~timenow-86400000~$2($81,i:1)~v:max_bars_back(close,365):v~close@$82~close@$44~close@$63~$5!$6!$7!$8!$9!$13!$14!$15!$16!$17!$26!$27!$28!$29!$32!$33!$34!$35!$38!$39!$40!$41!$46!$47!$48!$49!$54!$56!$58!$59!$60!$61!$65!$66!$67!$68!$69!$70!$71!$72!$73!$64!$74!$76!$77!$80!$84!$85!$86;t:str.substring(ticker,0,str.length(ticker):i-1):t~t:sc(t:syminfo.prefix,t:':',t:$10):t~i:na():f~sym($11,period,period,0,0,1,'NONE',0,0,$12)|$8()|s49:$9($14):s49~$16!$17!$18!$19!$20!$21!$22!$23!$24!$25!$26!$27!$28!$29!$30!$31!$32!$33!$34!$35!$36!$37!$38!$39!$40!$41!$42!$43!$44!$45!$46!$47!$48!$49!$50!$51!$52!$53!$54!$55!$56!$57!$58!$59!$60!$61!$62!$63!$64",
"isFake": false
},
{
Expand Down
Loading