Prime Distance Frame Quant Model for Risk Reward & Pivot Points
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Eliza123123

//@version=4
study("Prime Frame", overlay = true)


scale = 0.0

if close > 10000
    scale := 1000

if close > 999.999999 and close <= 10000
    scale := 100
  
if close >= 100 and close <= 999.999999
    scale := 10
  
if close >= 10 and close <= 99.999999
    scale := 1
  
if close >= 1 and close <= 9.999999
    scale := 0.1
  
if close >= 0.1 and close <= 0.999999
    scale := 0.01
 
if close >= 0.01 and close <= 0.0999999
    scale := 0.001

if close >= 0.001 and close <= 0.00999999
    scale := 0.0001

prime2 = 2 * scale, prime3 = 3 * scale, prime5 = 5 * scale, prime7 = 7 * scale, prime11 = 11 * scale, prime13 = 13 * scale, prime17 = 17 * scale
prime19 = 19 * scale, prime23 = 23 * scale, prime29 = 29 * scale, prime31 = 31 * scale, prime37 = 37 * scale, prime41 = 41 * scale, prime43 = 43 * scale
prime47 = 47 * scale, prime53 = 53 * scale, prime59 = 59 * scale, prime61 = 61 * scale, prime67 = 67 * scale, prime71 = 71 * scale, prime73 = 73 * scale
prime79 = 79 * scale, prime83 = 83 * scale, prime89 = 89 * scale, prime97 = 97 * scale

plot2 = plot(prime2, color = color.olive, linewidth = 2)
plot3 = plot(prime3, color = color.olive, linewidth = 2)
plot5 = plot(prime5, color = color.olive, linewidth = 2)
plot7 = plot(prime7, color = color.olive, linewidth = 2)
plot11 = plot(prime11, color = color.olive, linewidth = 2)
plot13 = plot(prime13, color = color.olive, linewidth = 2)
plot17 = plot(prime17, color = color.olive, linewidth = 2)
plot19 = plot(prime19, color = color.olive, linewidth = 2)
plot23 = plot(prime23, color = color.olive, linewidth = 2)
plot29 = plot(prime29, color = color.olive, linewidth = 2)
plot31 = plot(prime31, color = color.olive, linewidth = 2)
plot37 = plot(prime37, color = color.olive, linewidth = 2)
plot41 = plot(prime41, color = color.olive, linewidth = 2)
plot43 = plot(prime43, color = color.olive, linewidth = 2)
plot47 = plot(prime47, color = color.olive, linewidth = 2)
plot53 = plot(prime53, color = color.olive, linewidth = 2)
plot59 = plot(prime59, color = color.olive, linewidth = 2)
plot61 = plot(prime61, color = color.olive, linewidth = 2)
plot67 = plot(prime67, color = color.olive, linewidth = 2)
plot71 = plot(prime71, color = color.olive, linewidth = 2)
plot73 = plot(prime73, color = color.olive, linewidth = 2)
plot79 = plot(prime79, color = color.olive, linewidth = 2)
plot83 = plot(prime83, color = color.olive, linewidth = 2)
plot89 = plot(prime89, color = color.olive, linewidth = 2)
plot97 = plot(prime97, color = color.olive, linewidth = 2)


indicator_roof = 100 * scale
indicator_roofplot = plot(indicator_roof, color = color.white)



//Prime Gap of 1
fill(plot2, plot3, color = color.red, transp = 80)

//Prime Gap of 2
fill(plot3, plot5, color = color.aqua, transp = 80)
fill(plot5, plot7, color = color.aqua, transp = 80)
fill(plot11, plot13, color = color.aqua, transp = 80)
fill(plot17, plot19, color = color.aqua, transp = 80)
fill(plot29, plot31, color = color.aqua, transp = 80)
fill(plot41, plot43, color = color.aqua, transp = 80)
fill(plot59, plot61, color = color.aqua, transp = 80)
fill(plot71, plot73, color = color.aqua, transp = 80)

//Prime Gap of 4
fill(plot7, plot11, color = color.yellow, transp = 80)
fill(plot13, plot17, color = color.yellow, transp = 80)
fill(plot19, plot23, color = color.yellow, transp = 80)
fill(plot37, plot41, color = color.yellow, transp = 80)
fill(plot43, plot47, color = color.yellow, transp = 80)
fill(plot67, plot71, color = color.yellow, transp = 80)
fill(plot79, plot83, color = color.yellow, transp = 80)

//Prime Gap of 6
fill(plot23, plot29, color = color.purple, transp = 80)
fill(plot31, plot37, color = color.purple, transp = 80)
fill(plot47, plot53, color = color.purple, transp = 80)
fill(plot53, plot59, color = color.purple, transp = 80)
fill(plot61, plot67, color = color.purple, transp = 80)
fill(plot73, plot79, color = color.purple, transp = 80)
fill(plot83, plot89, color = color.purple, transp = 80)

//Prime Gap of 8
fill(plot89, plot97, color = color.lime, transp = 80)

//Indicator Roof
fill(plot97, indicator_roofplot, color = color.white, transp = 0)




