Indicateur C17V2 
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © W-Levrai
//@version=4
study("C17v2", overlay=true)
//voidlines=context
voidLines = input(true, "Context On/Off")
emaLines = input(true, "EMA (7, 8, 20, 21, 200, 800) On / Off")



//Color Gradient Code
//Shoutout to @LunaOwl for Making This!

//Red                                 //Orange
Red_1 = color.new(#FF0000,  0),       Orange_1 = color.new(#FF9800,  0)
Red_2 = color.new(#FF0000, 30),       Orange_2 = color.new(#FF9800, 30)
Red_3 = color.new(#FF0000, 50),       Orange_3 = color.new(#FF9800, 50)
Red_4 = color.new(#FF0000, 60),       Orange_4 = color.new(#FF9800, 70)
Red_5 = color.new(#FF0000, 80),       Orange_5 = color.new(#FF9800, 80)

//Yellow                              //Green
Yellow_1 = color.new(#FFE500,  0),    Green_1 = color.new(#00FF00,  0)
Yellow_2 = color.new(#FFE500, 30),    Green_2 = color.new(#00FF00, 30)
Yellow_3 = color.new(#FFE500, 50),    Green_3 = color.new(#00FF00, 50)
Yellow_4 = color.new(#FFE500, 60),    Green_4 = color.new(#00FF00, 70)
Yellow_5 = color.new(#FFE500, 80),    Green_5 = color.new(#00FF00, 80)

//Blue                                //Indigo
Blue_1 = color.new(#4985E7,  0),      Indigo_1 = color.new(#7A2BCE,  0)
Blue_2 = color.new(#4985E7, 30),      Indigo_2 = color.new(#7A2BCE, 30)
Blue_3 = color.new(#4985E7, 50),      Indigo_3 = color.new(#7A2BCE, 50)
Blue_4 = color.new(#4985E7, 60),      Indigo_4 = color.new(#7A2BCE, 60)
Blue_5 = color.new(#4985E7, 80),      Indigo_5 = color.new(#7A2BCE, 80)

//Purple
Purple_1 = color.new(#D12FAD,  0)
Purple_2 = color.new(#D12FAD, 30)
Purple_3 = color.new(#D12FAD, 50)
Purple_4 = color.new(#D12FAD, 60)
Purple_5 = color.new(#D12FAD, 80)


//Creates Color Variable       //Creates Math Variable
var color c = na,              var int k = na

k := nz(k[1], 1)      //This Equation Allows the Colors to Loop

//This Code Loops Through 63 Shades of 7 Colors//

if k == 1
    c := Red_5
if k == 2
    c := Red_4
if k == 3
    c := Red_3
if k == 4
    c := Red_2
if k == 5
    c := Red_1
if k == 6
    c := Red_2
if k == 7
    c := Red_3
if k == 8
    c := Red_4
if k == 9
    c := Red_5
if k == 10
    c := Orange_5
if k == 11
    c := Orange_4
if k == 12
    c := Orange_3
if k == 13
    c := Orange_2
if k == 14
    c := Orange_1
if k == 15
    c := Orange_2
if k == 16
    c := Orange_3
if k == 17
    c := Orange_4
if k == 18
    c := Orange_5
if k == 19
    c := Yellow_5
if k == 20
    c := Yellow_4
if k == 21
    c := Yellow_3
if k == 22
    c := Yellow_2
if k == 23
    c := Yellow_1
if k == 24
    c := Yellow_2
if k == 25
    c := Yellow_3
if k == 26
    c := Yellow_4
if k == 27
    c := Yellow_5
if k == 28
    c := Green_5
if k == 29
    c := Green_4
if k == 30
    c := Green_3
if k == 31
    c := Green_2
if k == 32
    c := Green_1
if k == 33
    c := Green_2
if k == 34
    c := Green_3
if k == 35
    c := Green_4
if k == 36
    c := Green_5
if k == 37
    c := Blue_5
if k == 38
    c := Blue_4
if k == 39
    c := Blue_3
if k == 40
    c := Blue_2
if k == 41
    c := Blue_1
if k == 42
    c := Blue_2
if k == 43
    c := Blue_3
if k == 44
    c := Blue_4     
if k == 45
    c := Blue_5   
if k == 46
    c := Indigo_5
if k == 47
    c := Indigo_4
if k == 48
    c := Indigo_3
if k == 49
    c := Indigo_2
if k == 50
    c := Indigo_1
if k == 51
    c := Indigo_2
if k == 52
    c := Indigo_3
if k == 53
    c := Indigo_4
if k == 54
    c := Indigo_5
if k == 55
    c := Purple_5
if k == 56
    c := Purple_4
if k == 57
    c := Purple_3
if k == 58
    c := Purple_2
if k == 59
    c := Purple_1
if k == 60
    c := Purple_2
if k == 61
    c := Purple_3
if k == 62
    c := Purple_4
if k == 63
    c := Purple_5

k := k + 1

if k > 63
    k := 1
    
//Defines EMA Variables
ema7 = ema(close, 7)
ema8 = ema(close, 8)
ema20 = ema(close, 20)
ema21 = ema(close, 21)
ema200 = ema(close, 200)
ema800 = ema(close, 800)



//Defines Variables Used in Void Lines
basis = sma(close, 20)
twoDev = 2 * stdev(close, 20)
upper3 = basis + twoDev
lower3 = basis - twoDev
threeDev = 3 * stdev(close, 20)
upper4 = basis + threeDev
lower4 = basis - threeDev

//Plots Void Lines
plot(voidLines ? basis : na, "Basis", color.purple, editable=false)
p5 = plot(voidLines ? upper3 : na, "Upper 200%", c, editable=false)
p6 = plot(voidLines ? lower3 : na, "Lower 200%", c, editable=false)
p7 = plot(voidLines ? upper4 : na, "Upper 300%", c, editable=false)
p8 = plot(voidLines ? lower4 : na, "Lower 300%", c, editable=false)
fill(p7, p5, color.teal, 75)
fill(p8, p6, color.purple, 75)

//Plots EMA Lines
plot(emaLines ? ema7 : na, "EMA 7", color.red, 2)
plot(emaLines ? ema8 : na, "EMA 8", color.yellow, 2)
plot(emaLines ? ema20 : na, "EMA 20", color.green, 2)
plot(emaLines ? ema21 : na, "EMA 21", color.blue, 2)
plot(emaLines ? ema200: na, "EMA 200", color.white, 2)
plot(emaLines ? ema800 : na, "EMA 800", color.aqua, 2)


