version 2
version 2
//*************************************
// Discontinued Indicator - No Longer supported. Please update to by using the latest version
now called "Diddly - Charts (Asian, London & New York Session + Weekdays)"
//*************************************
user_ssth = input(title="Start Session Hour (EST)", defval="20", options=["00", "01", "02", "03",
"04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20",
"21", "22", "23"])
user_esth = input(title="End Session Hour (EST)", defval="02", options=["00", "01", "02", "03",
"04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20",
"21", "22", "23"])
// End London
ny_ssth = input(title="New York Start Hour (EST)", defval="08", options=["00", "01", "02", "03",
"04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20",
"21", "22", "23"])
ny_sstm = input(title="New York Start Minute (EST)", defval="00", options=["00", "15", "30",
"45"])
ny_esth = input(title="New York End Hour (EST)", defval="12", options=["00", "01", "02", "03",
"04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20",
"21", "22", "23"])
ny_estm = input(title="New York End Minute (EST)", defval="00", options=["00", "15", "30",
"45"])
//
//
daily_adr = daily_adr_user
if (dayofweek.sunday)
daily_adr := daily_adr + 1
if (dayofweek.saturday)
daily_adr := daily_adr + 1
//
lblTP = 70
tickerExchangeOffset = 4
// Asian Session
int start_session_hour_int = 0
int end_session_hour_int = 0
int end_line_hour_int = 0
// End Section
// London Session
int london_start_session_hour_int = 0
int london_end_session_hour_int = 0
london_end_session_minute_int_offset = (london_end_session_minute_int +
chart_time_period_int)
// End Section
// NY Session
int ny_start_session_hour_int = 0
int ny_end_session_hour_int = 0
// End Section
// Support Structures Time Details
start_support_hour_int = 17
start_support_minute_int = 0
end_support_hour_int = 17
end_support_minute_int = 0
// End Section
// So need to adjust
if (syminfo.timezone == "Etc/UTC")
// Asian Condition
user_ssth := "00"
else
else
else
user_ssth := tostring(start_session_hour_int)
if (end_session_hour_int == 24)
user_esth := "00"
else
else
else
user_esth := tostring(end_session_hour_int)
// End Condition
// London Condition
if (london_start_session_hour_int == 24)
london_ssth := "00"
else
else
else
london_ssth := tostring(london_start_session_hour_int)
if (london_end_session_hour_int == 24)
london_esth := "00"
else
else
else
london_esth := tostring(london_end_session_hour_int)
// End Condition
if (ny_start_session_hour_int == 24)
ny_ssth := "00"
else
else
else
ny_ssth := tostring(ny_start_session_hour_int)
if (ny_end_session_hour_int == 24)
ny_esth := "00"
else
else
else
ny_esth := tostring(ny_end_session_hour_int)
// End Condition
// End Section
//
rth_ses = ""
london_rth_ses = ""
ny_rth_ses = ""
rth_fill_ses = ""
london_rth_fill_ses = ""
ny_rth_fill_ses = ""
// RM changed the session details, rather than using offset to the user input minute
// Note - Not 100% sure why this complex logic was introduced. There could be knockon issues,
so have retained existing logic remmed out.
// Actually looks like the extended logic is due to the back fill of the range
// Check the timeframe and the expected time and adjust appropiately
else
else
// General Functions
open_bar(ses) =>
t = time("D", ses)
is_end_day() =>
is_new_day() =>
get_label_offset(session) =>
// still perceives is yesterday when the new trading day has started
is_new_day_switch_period() =>
(hour >= 20 and minute == 0) and (hour <= 23 and minute <= 59) ? true: false
//
// Calculate ADR
adr(length) =>
sma(range[1], length)
to_pips(val) =>
one_day = 1000 * 60 * 60 * 24
srcHi = high
srcLo = low
var hi = 10e-10
var lo = 10e10
startTimeDelta = 24 - start_session_hour_int + 1
endTimeDelta = 24 - start_session_hour_int + 1
//
isStartTimeAlignment = startTimeAlignment()
endBoxTimeAlignment() => start_session_hour_int >= end_session_hour_int and (hour +
startTimeDelta) > 24? 1 : start_session_hour_int >= end_session_hour_int and (hour +
startTimeDelta) <= 24? 0 : start_session_hour_int < end_session_hour_int and (hour +
startTimeDelta) > 24? 0 : -1
isEndBoxTimeAlignment = endBoxTimeAlignment()
// Change above to support end of session being on the same day as the start on EST
isEndTimeAlignment = endTimeAlignment()
rth_open_bar = open_bar(rth_ses)
rth_is_open = is_open(rth_ses)
rth_low = float(na)
rth_high = float(na)
float range = na
line.delete(trl[1])
line.delete(trh[1])
line.delete(trm[1])
startBox = line.new(FromDate, rth_high, FromDate, rth_low, extend=extend.none,
xloc=xloc.bar_time, color=line_color, style=box_line_style, width=boxLineWidth)
line.delete(startBox[1])
line.delete(endBox[1])
// End Section
line.delete(tl[1])
line.delete(th[1])
line.delete(tm[1])
// End Section
highRes = rth_high
lowRes = rth_low
lineColor = color.new(color.white,100)
range := ((rth_high[1]-rth_low[1])/(syminfo.mintick))/10
labelTime = get_label_offset(inSession)
else
londonStartTimeDelta = 24 - london_start_session_hour_int + 1
londonEndTimeDelta = 24 - london_end_session_hour_int + 1
isLondonStartTimeAlignment = startLondonTimeAlignment()
// These function deal with the shift of the box from one day to the next
// At the moment they appear a little early. But wonder whether that is a
// Nice feature to show the user that the session is about to start
// Cause issue with displaying - works better with the above statement
isLondonEndTimeAlignment = endLondonTimeAlignment()
float london_range = na
LondonFromDate = timestamp(year, month, dayofmonth - isLondonStartTimeAlignment,
london_start_session_hour_int, london_start_session_minute_int)
london_rth_open_bar = open_bar(london_rth_ses)
london_rth_is_open = is_open(london_rth_ses)
london_rth_low = float(na)
london_rth_high = float(na)
//if inSession
line.delete(ltrl[1])
ltrh = line.new(LondonFromDate, london_rth_high, LondonToDate, london_rth_high,
xloc=xloc.bar_time, color=lline_color, style=lbox_line_style, width = lboxLineWidth)
line.delete(ltrh[1])
line.delete(ltrm[1])
line.delete(londonStartBox[1])
line.delete(londonEndBox[1])
// End Section
//line.delete(tl[1])
//line.delete(tm[1])
// End Section
// End Condition
londonHighRes = london_rth_high
londonLowRes = london_rth_low
LondonLineColor = color.new(color.white,100)
london_range := ((london_rth_high[1]-london_rth_low[1])/(syminfo.mintick))/10
londonLabelTime = get_label_offset(inLondonSession)
// End Sesction
nyStartTimeDelta = 24 - ny_start_session_hour_int + 1
nyEndTimeDelta = 24 - ny_end_session_hour_int + 1
isNyStartTimeAlignment = startNyTimeAlignment()
isNyEndTimeAlignment = endNyTimeAlignment()
float ny_range = na
NyFromDate = timestamp(year, month, dayofmonth - isNyStartTimeAlignment,
ny_start_session_hour_int, ny_start_session_minute_int)
ny_rth_open_bar = open_bar(ny_rth_ses)
ny_rth_is_open = is_open(ny_rth_ses)
ny_rth_low = float(na)
ny_rth_high = float(na)
//if inSession
line.delete(ntrh[1])
line.delete(ntrm[1])
line.delete(nyStartBox[1])
line.delete(nyEndBox[1])
// End Section
//line.delete(tl[1])
//th = line.new(LineFromDate, rth_high, LineToDate, rth_high, xloc=xloc.bar_time,
color=line_color, style=upperlower_line_style, width = sessionLineWidth)
//line.delete(th[1])
//line.delete(tm[1])
// End Section
// End Condition
nyHighRes = ny_rth_high
nyLowRes = ny_rth_low
NyLineColor = color.new(color.white,100)
ny_range := ((ny_rth_high[1]-ny_rth_low[1])/(syminfo.mintick))/10
nyLabelTime = get_label_offset(inNySession)
// End Sesction
wh = getData('1W', high[0])
wl = getData('1W', low[0])
float pdh_label_price = na
float pdl_label_price = na
int checkSwitch = 1
if (is_new_day_switch_period())
checkSwitch = 0
else
checkSwitch = 1
supportStartTimeDelta = 24 - start_session_hour_int + 1
supportEndTimeDelta = 24 - start_session_hour_int + 1
isSupportStartTimeAlignment = supportStartTimeAlignment()
isSupportEndTimeAlignment = supportEndTimeAlignment()
line.delete(yesterdayHighLine[1])
line.delete(yesterdayLowLine[1])
pdCheckIsNewDay = is_new_day()
if (showHiLoPriceLabel)
label.delete(pdHi_label[1])
// Add Previous Day Low
label.delete(pdLow_label[1])
else
label.delete(pdHi_label[1])
label.delete(pdHi_label[1])
label.delete(pdLow_label[1])
line.delete(weekHighLine[1])
line.delete(weekLowLine[1])
label.delete(wkHi_label[1])
label.delete(wkLow_label[1])
line.delete(weekLastHighLine[1])
line.delete(weekLastLowLine[1])
label.delete(lwkHi_label[1])
label.delete(lwkLow_label[1])
endOfDay = is_end_day()
//rsi = rsi(close, 7)
lookbackLength = 95
hb = highestbars(lookbackLength)
highBarIndex = -hb
highBarTime = time[highBarIndex]
highBarHour = hour[highBarIndex]
highBarMinute = minute[highBarIndex]
lb = lowestbars(lookbackLength)
lowBarIndex = -lb
lowBarTime = time[lowBarIndex]
lowBarHour = hour[lowBarIndex]
lowBarMinute = minute[lowBarIndex]
highOfDayHour = highBarHour
lowOfDayHour = lowBarHour
isCloseBelow = false
isCloseAbove = false
isCloseAbove := true
// Debugger Section
//
//