Cosmic Markers Lite
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © cosmic_indicators

//@version=5
indicator('Cosmic Markers Lite', shorttitle='CM Lite', overlay=true)

// --------------------------------------------------------------------------------
// Constants
// --------------------------------------------------------------------------------

// Colors
// ----------------------------------------

var blue_hex = #0d74ff
var yellow_hex = #ffd900

// Periods
// ----------------------------------------

len1 = 100
len2 = 250
len3 = 500
len4 = 750
len5 = 999

// --------------------------------------------------------------------------------
// Variables
// --------------------------------------------------------------------------------

r_score = 0
s_score = 0

// --------------------------------------------------------------------------------
// Logic
// --------------------------------------------------------------------------------

r_score += ta.highestbars(high, len1) == 0 ? 1 : 0
r_score += ta.highestbars(high, len2) == 0 ? 1 : 0
r_score += ta.highestbars(high, len3) == 0 ? 1 : 0
r_score += ta.highestbars(high, len4) == 0 ? 1 : 0
r_score += ta.highestbars(high, len5) == 0 ? 1 : 0

s_score += ta.lowestbars(low, len1) == 0 ? 1 : 0
s_score += ta.lowestbars(low, len2) == 0 ? 1 : 0
s_score += ta.lowestbars(low, len3) == 0 ? 1 : 0
s_score += ta.lowestbars(low, len4) == 0 ? 1 : 0
s_score += ta.lowestbars(low, len5) == 0 ? 1 : 0

// --------------------------------------------------------------------------------
// View
// --------------------------------------------------------------------------------

// R
// ----------------------------------------

plotshape(r_score == 1, style=shape.cross, location=location.abovebar, size=size.tiny, color=color.new(color.gray, 33))
plotshape(r_score == 2, style=shape.diamond, location=location.abovebar, size=size.tiny, color=color.new(color.gray, 20))
plotshape(r_score == 3, style=shape.diamond, location=location.abovebar, size=size.tiny, color=color.new(color.teal, 0))
plotshape(r_score == 4, style=shape.circle, location=location.abovebar, size=size.tiny, color=color.new(color.aqua, 10))
plotshape(r_score == 5, style=shape.circle, location=location.abovebar, size=size.tiny, color=color.new(blue_hex, 10))

// S
// ----------------------------------------

plotshape(s_score == 1, style=shape.cross, location=location.belowbar, size=size.tiny, color=color.new(color.gray, 33))
plotshape(s_score == 2, style=shape.diamond, location=location.belowbar, size=size.tiny, color=color.new(color.gray, 15))
plotshape(s_score == 3, style=shape.diamond, location=location.belowbar, size=size.tiny, color=color.new(yellow_hex, 20))
plotshape(s_score == 4, style=shape.circle, location=location.belowbar, size=size.tiny, color=color.new(color.orange, 10))
plotshape(s_score == 5, style=shape.circle, location=location.belowbar, size=size.tiny, color=color.new(color.red, 10))
