# wicklines_futurecloud_00b
# https://usethinkscript.com/threads/tos-scan-for-imaginary-horizontal-price-level.9818/#post-88419
def bn = barnumber();
def na = double.nan;
def lastbarbn = highestall( if !isnan(close) then bn else 0 );
def lastbar = if bn == lastbarbn then 1 else 0;
input future = 0;
def x1 = lastbar[future];
input cldwide = 6;
def cldx = if (bn >= lastbarbn + future and bn <= lastbarbn + future + cldwide) then 1 else 0;
input show_agg_clouds = yes;
def agg = AggregationPeriod.week;
def o = open( period=agg)[0];
def c = close( period=agg)[0];
plot z1 = if show_agg_clouds then o else na;
plot z2 = if show_agg_clouds then c else na;
z1.setdefaultcolor(getcolor(6));
z2.setdefaultcolor(getcolor(5));
z1.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
z2.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
addcloud(z2,z1,color.light_green, color.light_red);
# green / red
#input col1 = 6;
#input col2 = 5;
input col1 = 9;
input col2 = 9;
#-----------------------------
#set1 , repeat 24x
def oagg = open( period=agg)[0+future];
def cagg = close( period=agg)[0+future];
addcloud( (if cldx then oagg else na), (if cldx then cagg else na), getcolor(col1), getcolor(col2) );
#-----------------------------
#-----------------------------
# set2
def oagg2 = open( period=agg)[1+future];
def cagg2 = close( period=agg)[1+future];
addcloud( (if cldx then oagg2 else na),(if cldx then cagg2 else na),getcolor(col1),getcolor(col2) );
#-----------------------------
# set3
def oagg3 = open( period=agg)[2+future];
def cagg3 = close( period=agg)[2+future];
addcloud( (if cldx then oagg3 else na),(if cldx then cagg3 else na),getcolor(col1),getcolor(col2) );
#-----------------------------
# set4
def oagg4 = open( period=agg)[3+future];
def cagg4 = close( period=agg)[3+future];
addcloud( (if cldx then oagg4 else na),(if cldx then cagg4 else na),getcolor(col1),getcolor(col2) );
#-----------------------------
# set5
def oagg5 = open( period=agg)[4+future];
def cagg5 = close( period=agg)[4+future];
addcloud( (if cldx then oagg5 else na),(if cldx then cagg5 else na),getcolor(col1),getcolor(col2) );
#-----------------------------
# set6
def oagg6 = open( period=agg)[5+future];
def cagg6 = close( period=agg)[5+future];
addcloud( (if cldx then oagg6 else na),(if cldx then cagg6 else na),getcolor(col1),getcolor(col2) );
#-----------------------------
# set7
def oagg7 = open( period=agg)[6+future];
def cagg7 = close( period=agg)[6+future];
addcloud( (if cldx then oagg7 else na),(if cldx then cagg7 else na),getcolor(col1),getcolor(col2) );
#-----------------------------
# set8
def oagg8 = open( period=agg)[7+future];
def cagg8 = close( period=agg)[7+future];
addcloud( (if cldx then oagg8 else na),(if cldx then cagg8 else na),getcolor(col1),getcolor(col2) );
#-----------------------------
# set9
def oagg9 = open( period=agg)[8+future];
def cagg9 = close( period=agg)[8+future];
addcloud( (if cldx then oagg9 else na),(if cldx then cagg9 else na),getcolor(col1),getcolor(col2) );
#-----------------------------
# set10
def oagg10 = open( period=agg)[9+future];
def cagg10 = close( period=agg)[9+future];
addcloud( (if cldx then oagg10 else na),(if cldx then cagg10 else na),getcolor(col1),getcolor(col2) );
#-----------------------------
#-----------------------------
# set11
def oagg11 = open( period=agg)[10+future];
def cagg11 = close( period=agg)[10+future];
addcloud( (if cldx then oagg11 else na),(if cldx then cagg11 else na),getcolor(col1),getcolor(col2) );
#-----------------------------
# set12
def oagg12 = open( period=agg)[11+future];
def cagg12 = close( period=agg)[11+future];
addcloud( (if cldx then oagg12 else na),(if cldx then cagg12 else na),getcolor(col1),getcolor(col2) );
#-----------------------------
# set13
def oagg13 = open( period=agg)[12+future];
def cagg13 = close( period=agg)[12+future];
addcloud( (if cldx then oagg13 else na),(if cldx then cagg13 else na),getcolor(col1),getcolor(col2) );
#-----------------------------
# set14
def oagg14 = open( period=agg)[13+future];
def cagg14 = close( period=agg)[13+future];
addcloud( (if cldx then oagg14 else na),(if cldx then cagg14 else na),getcolor(col1),getcolor(col2) );
#-----------------------------
# set15
def oagg15 = open( period=agg)[14+future];
def cagg15 = close( period=agg)[14+future];
addcloud( (if cldx then oagg15 else na),(if cldx then cagg15 else na),getcolor(col1),getcolor(col2) );
#-----------------------------
# set16
def oagg16 = open( period=agg)[15+future];
def cagg16 = close( period=agg)[15+future];
addcloud( (if cldx then oagg16 else na),(if cldx then cagg16 else na),getcolor(col1),getcolor(col2) );
#-----------------------------
# set17
def oagg17 = open( period=agg)[16+future];
def cagg17 = close( period=agg)[16+future];
addcloud( (if cldx then oagg17 else na),(if cldx then cagg17 else na),getcolor(col1),getcolor(col2) );
#-----------------------------
# set18
def oagg18 = open( period=agg)[17+future];
def cagg18 = close( period=agg)[17+future];
addcloud( (if cldx then oagg18 else na),(if cldx then cagg18 else na),getcolor(col1),getcolor(col2) );
#-----------------------------
# set19
def oagg19 = open( period=agg)[18+future];
def cagg19 = close( period=agg)[18+future];
addcloud( (if cldx then oagg19 else na),(if cldx then cagg19 else na),getcolor(col1),getcolor(col2) );
#-----------------------------
# set20
def oagg20 = open( period=agg)[19+future];
def cagg20 = close( period=agg)[19+future];
addcloud( (if cldx then oagg20 else na),(if cldx then cagg20 else na),getcolor(col1),getcolor(col2) );
#-----------------------------
#-----------------------------
# set21
def oagg21 = open( period=agg)[20+future];
def cagg21 = close( period=agg)[20+future];
addcloud( (if cldx then oagg21 else na),(if cldx then cagg21 else na),getcolor(col1),getcolor(col2) );
#-----------------------------
# set22
def oagg22 = open( period=agg)[21+future];
def cagg22 = close( period=agg)[21+future];
addcloud( (if cldx then oagg22 else na),(if cldx then cagg22 else na),getcolor(col1),getcolor(col2) );
#-----------------------------
# set23
def oagg23 = open( period=agg)[22+future];
def cagg23 = close( period=agg)[22+future];
addcloud( (if cldx then oagg23 else na),(if cldx then cagg23 else na),getcolor(col1),getcolor(col2) );
#-----------------------------
# set24
def oagg24 = open( period=agg)[23+future];
def cagg24 = close( period=agg)[23+future];
addcloud( (if cldx then oagg24 else na),(if cldx then cagg24 else na),getcolor(col1),getcolor(col2) );
#-----------------------------
#-----------------------------
# setx
input test_range = no;
def r = 1;
def oaggx = if test_range then open( period=agg)[r+future] else na;
def caggx = close( period=agg)[r+future];
addcloud( (if cldx[3] then oaggx else na),(if cldx[3] then caggx else na),getcolor(5),getcolor(5) );
#-----------------------------
#