christianmarmol
New member
I would appreciate the help with this program Im trying to make the FVG zone appear and disappear if they get broken, I so far got them to disappear but can find the way to make appear again. I think i need to find a way to hold a variable for reuse but don't know how on thinkscript
input tamanoDelGap=3;
def bearFVGUp = high < low[2];
def bullFVGDown = low > high[2];
# Calculate the gap boundaries
def FVGUpTop = if (bearFVGUp and low[2]-high >tamanoDelGap)then low[2] else if( close < fvguptop[1])then fvguptop[1] else double.NaN;
def FVGUpBottom = if (bearFVGUp and low[2]-high >tamanoDelGap) then high else if( close < fvguptop[1])then FVGUpBottom[1] else double.NaN;
def FVGDownTop = if (bullFVGDown and high[2] - low <tamanoDelGap) then high[2] else if (close > fvgDownTop[1])then fvgDownTop[1] else double.NaN ;
def FVGDownBottom = if(bullFVGDown and high[2] - low <tamanoDelGap) then low else if (close > fvgDownTop[1])then FVGDownBottom[1] else double.NaN;
input cloudSize= 0;
DefineGlobalColor("CloudS", Color.gray);
DefineGlobalColor("CloudR", Color.gray);
#Global Color For Levels(Support)
DefineGlobalColor("UpLevels", Color.black);
#Global Color For Levels(Resistance)
DefineGlobalColor("DnLevels", Color.black);
plot cloud1Bear_top = FVGUpTop;
cloud1Bear_top.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
cloud1bear_top.setdefaultColor(color.red);
cloud1Bear_top.SetLineWeight(2);
plot cloud1Bear_bot = FVGUpBottom;
cloud1Bear_bot.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
cloud1Bear_bot.setdefaultColor(color.red);
cloud1Bear_bot.SetLineWeight(2);
AddCloud(cloud1Bear_top, cloud1Bear_bot, GlobalColor("CloudS"), GlobalColor("CloudS"), yes);
plot cloud1Bull_top = FVGDownTop ;
cloud1Bull_top.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
cloud1Bull_top.setdefaultColor(color.green);
cloud1Bull_top.SetLineWeight(2);
plot cloud1Bull_bot = FVGDownBottom ;
cloud1Bull_bot.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
cloud1Bull_bot.setdefaultColor(color.green);
cloud1Bull_bot.SetLineWeight(2);
AddCloud(cloud1Bull_top, cloud1Bull_bot, GlobalColor("CloudS"), GlobalColor("CloudS"), yes);
input tamanoDelGap=3;
def bearFVGUp = high < low[2];
def bullFVGDown = low > high[2];
# Calculate the gap boundaries
def FVGUpTop = if (bearFVGUp and low[2]-high >tamanoDelGap)then low[2] else if( close < fvguptop[1])then fvguptop[1] else double.NaN;
def FVGUpBottom = if (bearFVGUp and low[2]-high >tamanoDelGap) then high else if( close < fvguptop[1])then FVGUpBottom[1] else double.NaN;
def FVGDownTop = if (bullFVGDown and high[2] - low <tamanoDelGap) then high[2] else if (close > fvgDownTop[1])then fvgDownTop[1] else double.NaN ;
def FVGDownBottom = if(bullFVGDown and high[2] - low <tamanoDelGap) then low else if (close > fvgDownTop[1])then FVGDownBottom[1] else double.NaN;
input cloudSize= 0;
DefineGlobalColor("CloudS", Color.gray);
DefineGlobalColor("CloudR", Color.gray);
#Global Color For Levels(Support)
DefineGlobalColor("UpLevels", Color.black);
#Global Color For Levels(Resistance)
DefineGlobalColor("DnLevels", Color.black);
plot cloud1Bear_top = FVGUpTop;
cloud1Bear_top.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
cloud1bear_top.setdefaultColor(color.red);
cloud1Bear_top.SetLineWeight(2);
plot cloud1Bear_bot = FVGUpBottom;
cloud1Bear_bot.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
cloud1Bear_bot.setdefaultColor(color.red);
cloud1Bear_bot.SetLineWeight(2);
AddCloud(cloud1Bear_top, cloud1Bear_bot, GlobalColor("CloudS"), GlobalColor("CloudS"), yes);
plot cloud1Bull_top = FVGDownTop ;
cloud1Bull_top.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
cloud1Bull_top.setdefaultColor(color.green);
cloud1Bull_top.SetLineWeight(2);
plot cloud1Bull_bot = FVGDownBottom ;
cloud1Bull_bot.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
cloud1Bull_bot.setdefaultColor(color.green);
cloud1Bull_bot.SetLineWeight(2);
AddCloud(cloud1Bull_top, cloud1Bull_bot, GlobalColor("CloudS"), GlobalColor("CloudS"), yes);