freedom Traders
New member
I was wondering if someone can set an alarm for me please. I tried many times but didn't succeed. I also noticed it doesn't print the dot right away,can someone hel please. It was posted by someone i can't remember. It would a great piece to add on a chart.
Code:
#Begin code
#updated by BonBon - swing_back and _swing_forward (February 4, 2021)
def bubbles = yes;
input swing_back = 45;
input swing_forward = 45;
input maxbars = 50;
input showlevels = Yes;
def sb = swing_back;
def sf = swing_forward;
def na = Double.NaN;
def Offset = 8; # high(period = "day")and low(period = "day" ) and close(period = "day" ) * 0.03;
def bubblelocation = bubbles[Offset];
def lfor = Lowest(low, sf)[-sf]; #Remember that a negative number inside the square brackets means "after" this bar. So, the above line is defining "lfor" as being the lowest value of the two bars after this bar.
def lback = Lowest(low, sb)[1]; #This line of code is defining "lback" as the lowest value of the eight bars before this one.
##############################
#Finally, this line is actually defining what a "swing low" is. It says, if the low of this bar is lower than the two bars after this one AND the low of this bar is also lower than or equal to the lowest of the previous eight bars, then this bar is a swing low.
def swinglow = if low < lfor and low <= lback then 1 else 0;
plot sl = if swinglow then low else na;
sl.SetPaintingStrategy(PaintingStrategy.POINTS);
sl.SetDefaultColor(Color.WHITE);
sl.SetLineWeight(4);
def hfor = Highest(high, sf)[-sf];
def hback = Highest(high, sb)[1];
def swinghigh = if high > hfor and high >= hback then 1 else 0;
plot sh = if swinghigh then high else na ;
sh.SetDefaultColor(Color.WHITE);
sh.SetPaintingStrategy(PaintingStrategy.POINTS);
sh.SetLineWeight(4);
ll);
#End code