Last active
February 21, 2021 01:45
-
-
Save oscarvs/53aaba009a65f8065c1e to your computer and use it in GitHub Desktop.
Pinescript Indicators for TradingView
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
study(title="13ema of On Balance Volume", shorttitle="13eOBV") | |
src = close, len = input(13, minval=1, title="Length") | |
out = cum(change(src) > 0 ? volume : change(src) < 0 ? -volume : 0*volume) | |
out2 = ema(out, len) | |
plot(out, color=orange, title="OBV") | |
plot(out2, title="EMA", color=gray) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Created by https://www.tradingview.com/u/oscarvs @ 18 October 2014 | @theoscarvs | |
// Inspired by @ICT_MHuddleston concepts and @CRInvestor courses, code based on @ChrisMoody scripts | |
// https://github.com/oscarvs/bitcoin-killzones | |
// Time sessions are directly sync from exchange/tv data (Change manually if you need to adjust DST Daylight saving time) | |
study(title="Bitcoin Kill Zones",shorttitle="Bitcoin Kill Zones", overlay=true) | |
timeinrange(res, sess) => time(res, sess) != 0 | |
// **** Checkboxes and custom Session | |
iKZNY = input(true, title="New York Kill Zone") | |
iOpenKZLondon = input(true, title="London Open Kill Zone") | |
iCloseKZLondon = input(true, title="London Close Kill Zone") | |
iAsiaKZ = input(true, title="Asia Kill Zone") | |
KZNY = input('1230-1430', type=session, title="New York Kill Zone") | |
LondonOpenKZ = input('0600-0800', type=session, title="London Open Kill Zone") | |
LondonCloseKZ = input('1500-1700', type=session, title="London Close Kill Zone") | |
AsiaKZ = input('2300-0300', type=session, title="Asia Kill Zone") | |
iRealOpenSessionAlertBar = input(true, title="Real Open Session Alert Bar") | |
NYOpenAlertBar = input('1330-1345', type=session, title="New York Open Session") | |
LondonOpenAlertBar = input('0700-0715', type=session, title="London Open Session") | |
LondonCloseAlertBar = input('1545-1600', type=session, title="London Close Session") | |
AsiaOpenAlertBar = input('0000-0015', type=session, title="Asia Open Session") | |
// **** Logic | |
sessToUse = iKZNY == 1 ? KZNY : '0000-0000' | |
sessToUse2 = iRealOpenSessionAlertBar == 1 ? NYOpenAlertBar : '0000-0000' | |
sessToUse3 = iOpenKZLondon == 1 ? LondonOpenKZ : '0000-0000' | |
sessToUse4 = iRealOpenSessionAlertBar == 1 ? LondonOpenAlertBar : '0000-0000' | |
sessToUse5 = iCloseKZLondon == 1 ? LondonCloseKZ : '0000-0000' | |
sessToUse6 = iRealOpenSessionAlertBar == 1 ? LondonCloseAlertBar : '0000-0000' | |
sessToUse7 = iAsiaKZ == 1 ? AsiaKZ : '0000-0000' | |
sessToUse8 = iRealOpenSessionAlertBar == 1 ? AsiaOpenAlertBar : '0000-0000' | |
// *** Apply custom rules | |
bgPlot = (iKZNY == 0 ? time(period) : time(period, sessToUse)) | |
bgPlot2 = (iRealOpenSessionAlertBar == 0 ? time(period) : time(period, sessToUse2)) | |
bgPlot3 = (iOpenKZLondon == 0 ? time(period) : time(period, sessToUse3)) | |
bgPlot4 = (iRealOpenSessionAlertBar == 0 ? time(period) : time(period, sessToUse4)) | |
bgPlot5 = (iCloseKZLondon == 0 ? time(period) : time(period, sessToUse5)) | |
bgPlot6 = (iRealOpenSessionAlertBar == 0 ? time(period) : time(period, sessToUse6)) | |
bgPlot7 = (iAsiaKZ == 0 ? time(period) : time(period, sessToUse7)) | |
bgPlot8 = (iRealOpenSessionAlertBar == 0 ? time(period) : time(period, sessToUse8)) | |
//**** Plot as background | |
bgcolor(iKZNY and bgPlot > 0 ? red : na, transp=90) | |
bgcolor(iKZNY and iRealOpenSessionAlertBar and bgPlot2 > 0 ? red : na, transp=70) | |
bgcolor(iOpenKZLondon and bgPlot3 > 0 ? green : na, transp=90) | |
bgcolor(iOpenKZLondon and iRealOpenSessionAlertBar and bgPlot4 > 0 ? green : na, transp=70) | |
bgcolor(iCloseKZLondon and bgPlot5 > 0 ? olive : na, transp=90) | |
bgcolor(iCloseKZLondon and iRealOpenSessionAlertBar and bgPlot6 > 0 ? olive : na, transp=70) | |
bgcolor(iAsiaKZ and bgPlot7 > 0 ? orange : na, transp=90) | |
bgcolor(iAsiaKZ and iRealOpenSessionAlertBar and bgPlot8 > 0 ? orange : na, transp=70) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
study(title="CRI Willams21EMA13", shorttitle="Willy") | |
length = input(21, minval=1) | |
upper = highest(length) | |
lower = lowest(length) | |
out = 100 * (close - upper) / (upper - lower) | |
src = out, len = input(13, minval=1, title="Length") | |
out2 = ema(out, len) | |
plot(out) | |
plot(out2, title="EMA", color=red, linewidth=2) | |
band1 = hline(-20) | |
band0 = hline(-80) | |
fill(band1, band0) | |
hline(-50) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment