Download as rtf, pdf, or txt
Download as rtf, pdf, or txt
You are on page 1of 3

//@version=4

study("NY", overlay=true)

// # COLORS
###################################################################
#######################

nyColor = #c11515 //#e91e63


nyColor2 = #ef9a9a
nySessionColor = nyColor
gmtColor = #000000
trueDayColor = #c11515//#085ba4
europeColor = nyColor //#9800ff
darkGray = #434651
darkRed = #970000

// # COLORS
###################################################################
########################

// # VARS
###################################################################
##########################

daysLookback = input(title="Lookback days", type=input.integer, defval=3)


showNYopen = input(title="Show NY open", type=input.bool, defval=true)
showTuesday = input(title="Show 'tuesday special'", type=input.bool, defval=true)
showEndTrueDay = input(title="Show true day end open", type=input.bool,
defval=true)
cutLines = input(title="Hide day dividers", type=input.bool, defval=false)

gmtOpen = timestamp("America/New_York", year, month, dayofmonth, 19, 0, 0)


gmtOpen2 = timestamp("UTC", year, month, dayofmonth, 0, 0, 0)
nyOpen = timestamp("America/New_York", year, month, dayofmonth, 0, 00, 00)
trueDayEnd = timestamp("America/New_York", year, month, dayofmonth, 15, 00, 00)
europeOpen = timestamp("America/New_York", year, month, dayofmonth, 4, 00, 00)
europeOpen2 = timestamp("America/New_York", year, month, dayofmonth, 6, 00,
00)

lookBack = 86400000
lookBackDays = lookBack * daysLookback

displayLimit = timeframe.multiplier <= 120


displayCondition = timeframe.isdwm == false and displayLimit and (time > (timenow -
lookBack))
extendedDisplayCondition = timeframe.isdwm == false and displayLimit and (time >
(timenow - lookBackDays))
sessionCondition =    timeframe.multiplier <= 15 and (time > (timenow -
lookBackDays))
// # VARS
###################################################################
##########################

// # FUNCTIONS
###################################################################
#######################

vline(BarIndex, Color, LineStyle, LineWidth) =>


        return = line.new(BarIndex, low, BarIndex, high, xloc.bar_index, (cutLines ?
extend.none : extend.both), Color, LineStyle, LineWidth)

drawPrice(startTime, price, clr, style, multiply, width) =>


        x = bar_index
        y = price
        line.new(x1=startTime, y1=y, color=clr, x2=time + (lookBack * multiply),
y2=y,xloc=xloc.bar_time, style=style, width = width)

nameForDay(day) =>
        var dayName = ""
        if day == 2
                dayName := "Mon"
        if day == 3
                dayName := "Tue"
        if day == 4
                dayName := "Wed"
        if day == 5
                dayName := "Thu"
        if day == 6
                dayName := "Fri"
        if day == 7
                dayName := "Sat"
        if day == 1
                dayName := "Sun"
        dayName // return

// # FUNCTIONS
###################################################################
#######################

// # DISPLAY
###################################################################
#########################

// ny open
if(time == nyOpen and extendedDisplayCondition and showNYopen)
        vline(bar_index, darkRed, line.style_dotted, 1)
        drawPrice(time, open, nyColor, line.style_solid, 1, 2)

// tue "europe open"


if nameForDay(dayofweek) == "Tue" and (time == europeOpen or time ==
europeOpen2) and showTuesday
        drawPrice(time, open, darkRed, line.style_dotted, 7, 2)

// true day end


if(showEndTrueDay and time == trueDayEnd and extendedDisplayCondition)
        //vline(bar_index, trueDayColor, line.style_dashed, 1)
        drawPrice(time, open, nyColor, line.style_dashed, 1, 1)

// # DISPLAY
###################################################################
#########################

You might also like