
Author Message:
This innovative tool is crafted to enhance your chart analysis by identifying potential reversal and breakout opportunities directly on your charts. It's designed with both novice and experienced traders in mind, providing intuitive visual cues for better decision-making.
More Details : https://www.tradingview.com/v/fpWwOup4/
Code:
CSS:
# https://www.tradingview.com/v/fpWwOup4/
#/ This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
#// © AlgoAlpha
#indicator("Reversal and Breakout Signals [AlgoAlpha]", "AlgoAlpha", overlay = true)
# Converted by Sam4Cok@Samer800 - 02/2024
input showSignals = yes;
input showHiLoLines = yes;
input showMidLine = yes;
input IndicatorPeriod = 20; #, "Indicator Period")
input VolumeStrengthPeriod = 20; #, "Volume Strength Period")
input StongVolumeThreshold = 2; #, "Stong Volume Threshold")
input ColourCandlesDuringTrends = yes; # "Colour Candles During Trends")
def na = Double.NaN;
DefineGlobalColor("green", CreateColor(0, 255, 187)); # "Bullish Colour"
DefineGlobalColor("red", Color.MAGENTA); # "Bearish Colour"
DefineGlobalColor("yellow", CreateColor(238, 255, 0)); # "Breakout Colour"
def hma = HullMovingAvg(close, 30);
def rvol = volume / Average(volume, VolumeStrengthPeriod);
def strongvol = rvol > StongVolumeThreshold;
def sh = WMA(high, IndicatorPeriod);
def sl = WMA(low, IndicatorPeriod);
def h = Highest(sh, IndicatorPeriod);
def l = Lowest(sl, IndicatorPeriod);
def hstore = if !(h < h[1] or h > h[1]) then h[1] else hstore[1];
def lstore = if !(l < l[1] or l > l[1]) then l[1] else lstore[1];
def mid = if hstore and lstore then (hstore + lstore) /2 else na;
def candledir = if close > open then 1 else -1;
def breakout = candledir == 1 and close > hstore and open < hstore;
def breakdown = candledir == -1 and close < lstore and open > lstore;
def bullishbreakout = (breakout or ((breakout[1] or breakout[2] or breakout[3] or breakout[4]) and candledir == 1)) and strongvol and !(bullishbreakout[1] or bullishbreakout[2] or bullishbreakout[3]);
def bearishbreakout = (breakdown or ((breakdown[1] or breakdown[2] or breakdown[3] or breakdown[4]) and candledir == -1)) and strongvol and !(bearishbreakout[1] or bearishbreakout[2] or bearishbreakout[3]);
def bullishrej = (low < lstore and close > lstore) and !(bullishrej[1] or bullishrej[2] or bullishrej[3] or bullishrej[4]) ;
def bearishrej = (high > hstore and close < hstore) and !(bearishrej[1] or bearishrej[2] or bearishrej[3] or bearishrej[4]);
def state = if bullishbreakout then 1 else
if bearishbreakout then -1 else
if ((low Crosses Above lstore) and state[1] == -1) or ((high Crosses Below hstore) and state[1] == 1) then 0 else state[1];
plot TrendTracker = if state != 0 then hma else na; # "Trend Tracker"
plot Upper = if showHiLoLines and hstore then hstore else na; # "Upper Level"
plot Lower = if showHiLoLines and lstore then lstore else na; # "Lower Level"
plot Midline = if showMidLine then mid else na; # "Midline"
plot pointHi = if Upper and hstore!=hstore[1] then hstore else na;
plot pointLo = if Lower and lstore!=lstore[1] then lstore else na;
pointLo.SetPaintingStrategy(PaintingStrategy.SQUARES);
pointLo.SetDefaultColor(Color.DARK_GREEN);
pointHi.SetPaintingStrategy(PaintingStrategy.SQUARES);
pointHi.SetDefaultColor(Color.DARK_RED);
TrendTracker.SetLineWeight(2);
TrendTracker.AssignValueColor(if state == 1 then GlobalColor("green") else GlobalColor("red"));
Upper.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
Upper.SetDefaultColor(Color.DARK_RED);
Lower.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
Lower.SetDefaultColor(Color.DARK_GREEN);
Midline.SetDefaultColor(Color.GRAY);
#-- Bubbles and bar colors
def candlecol = if ColourCandlesDuringTrends then (if state == 1 then 1 else if state == -1 then -1 else 0) else 0;
AssignPriceColor(if candlecol > 0 then GlobalColor("green") else
if candlecol < 0 then GlobalColor("red") else Color.CURRENT);
plot BullishReversal = if showSignals and bullishrej and !(state ==- 1) then low else na;
plot BearishReversal = if showSignals and bearishrej and !(state == 1) then high else na;
BullishReversal.SetDefaultColor(GlobalColor("green"));
BullishReversal.SetPaintingStrategy(PaintingStrategy.BOOLEAN_WEDGE_DOWN);
BearishReversal.SetDefaultColor(GlobalColor("red"));
BearishReversal.SetPaintingStrategy(PaintingStrategy.BOOLEAN_WEDGE_UP);
AddChartBubble(showSignals and bullishbreakout, low *0.9995, "B", GlobalColor("yellow"), no); # "Bullish Breakout"
AddChartBubble(showSignals and bearishbreakout, high * 1.0005, "B", GlobalColor("yellow")); # "Bearish Breakout"
AssignPriceColor(if bullishbreakout then GlobalColor("yellow") else
if bearishbreakout then GlobalColor("yellow") else Color.CURRENT);
#-- END of CODE