Monday's Range indicator

Would be nice to have “Monday Range” indicator ported in gainium, there is an opensource one in tradingview.

indicator('Monday Range (Lines)', overlay=true)

var market_open_day_of_week = input.string(title='What day of the week does the market open?', options=['Sunday', 'Monday'], defval='Sunday')  // Some exchanges open sunday evening vs crypto std monday
var bars_extended_to_week_end = input(title='Extend bars to end of week?', defval=true)
var bars_extent ='Length of bars', defval=20, minval=1, maxval=100)
var line_colour = input(#007FFF, 'Line colour')

monday_open_time =, 'D', time('D'), lookahead=barmerge.lookahead_on)
monday_high =, 'D', high, lookahead=barmerge.lookahead_on)
monday_low =, 'D', low, lookahead=barmerge.lookahead_on)
monday_midpoint = math.avg(monday_high, monday_low)

is_monday() =>
    dayofweek(time('D')) == (market_open_day_of_week == 'Sunday' ? dayofweek.sunday : dayofweek.monday) and close ? true : false

var can_show_monday_range = not timeframe.isweekly and not timeframe.ismonthly and not timeframe.isseconds  // dont show above daily or below minutes

line_end_bars = if bars_extended_to_week_end
    // Calculate the bars until the end of the week
    // timeframe.multiplier is either daily or minutes
    if timeframe.isdaily
        1440 / timeframe.multiplier * 7  // (mins in  day / multiplier) * days in a week

line_end_right = monday_open_time + (time - time[1]) * line_end_bars  // extend line until the end of the week or number of bars chosen

if is_monday()
    // Monday high
    monday_high_text = 'MH    '
    var monday_high_line =, x2=line_end_right, y1=monday_high, y2=monday_high, color=line_colour, width=1, xloc=xloc.bar_time)
    var monday_high_label =, y=monday_open_time, text=monday_high_text, style=label.style_none, textcolor=line_colour, size=size.small, xloc=xloc.bar_time)

    line.set_x1(monday_high_line, monday_open_time)
    line.set_x2(monday_high_line, line_end_right)
    line.set_y1(monday_high_line, monday_high)
    line.set_y2(monday_high_line, monday_high)
    label.set_x(monday_high_label, line_end_right)
    label.set_y(monday_high_label, monday_high)

    // Monday low
    monday_low_text = 'ML    '
    var monday_low_line =, x2=line_end_right, y1=monday_low, y2=monday_low, color=line_colour, width=1, xloc=xloc.bar_time)
    var monday_low_label =, y=monday_open_time, text=monday_low_text, style=label.style_none, textcolor=line_colour, size=size.small, xloc=xloc.bar_time)

    line.set_x1(monday_low_line, monday_open_time)
    line.set_x2(monday_low_line, line_end_right)
    line.set_y1(monday_low_line, monday_low)
    line.set_y2(monday_low_line, monday_low)
    label.set_x(monday_low_label, line_end_right)
    label.set_y(monday_low_label, monday_low)

    // Monday mid
    monday_mid_text = 'MID     '
    var monday_mid_line =, x2=line_end_right, y1=monday_midpoint, y2=monday_midpoint, color=line_colour, width=1, xloc=xloc.bar_time)
    var monday_mid_label =, y=monday_open_time, text=monday_mid_text, style=label.style_none, textcolor=line_colour, size=size.small, xloc=xloc.bar_time)

    line.set_x1(monday_mid_line, monday_open_time)
    line.set_x2(monday_mid_line, line_end_right)
    line.set_y1(monday_mid_line, monday_midpoint)
    line.set_y2(monday_mid_line, monday_midpoint)
    label.set_x(monday_mid_label, line_end_right)
    label.set_y(monday_mid_label, monday_midpoint)

We could use this as a deal start condition like: “start deal if ABOVE or BELOW monday’s High/Low” or “price crossing down/up monday’s low/high” to play the deviation of monday’s low/high with the Marklet structure indicator and RR tool.

1 Like

Interesting, how well does this apply to crypto though? Since crypto is 24/7, I would have thought that the Monday activity is not as important as for stocks.

I don’t know, maybe it’s just an easy setup… Sometimes it seems to work really well, for at least a 2R setup

Theese are just random examples, but i think we could build a nice strategy around this

I think it does apply at least for BTC and ETH. Not always respecting the rule that says " once monday low/high swept then the price goes for the other side of the monday range" but at least we can expect some volatility in those areas.

It definitely doesn’t always work, but I think it can be a good starting point to develop some profitable long-term strategies.

1 Like