Category Trend  Published on 06/11/2022

FVG - SIBI BISI

Description

Update on how to use FVG on targets and IED.

This indicator is like trading volume profile, top down analysis starting with the daily tf, the center line is the trough of the volume so use 50% between the coloured bands as the point of control it like a Point Of Control. 

 

 

 

 

 

 

 

 

Wait for the SIBI to form then use the low or high to draw out the levels to expect a reaction.

20min TF is best 

 

The indicator identifies gaps between the open and close of candles and highlights where price has been offered on one side only.

 The gap setting is best set at the overnight spread - ie on GBPUSD set to 11 pips min. 

The Zone is best set to your particular brokers spread on that pair.

HOW TO USE

All based on the belief that price is being delivered by IPDA ( Interbank Price Delivery Algorithm).

The algorithm is designed to offer price on both sides, this indicator is just a visual way of highlighting where price has only been delivered on one side.

Tips:

Leaving history on you will see that areas have an efficacy at the previous swing and if you are quick enough on the trigger can even play in the 1minTF.

Best to use in traditional top down analysis TF, Weekly / Daily  / 1 hr.

Credit for programming to Jiri @ Poshtrader. 

 

Example settings for 1 min TF (GBPUSD )

 


using System;
using System.Collections.Generic;
using cAlgo.API;
using cAlgo.API.Internals;

namespace cAlgo
{
    public class Colors
    {
        public Color GapZone { get; set; }
        public Color GapLine { get; set; }
        public Color UpZone { get; set; }
        public Color UpLine { get; set; }
        public Color DownZone { get; set; }
        public Color DownLine { get; set; }

        public static Color Get(string color, double opacity)
        {
            var baseColor = color[0] == '#' ? Color.FromHex(color) : Color.FromName(color);
            return Color.FromArgb((int)(opacity * 2.55), baseColor.R, baseColor.G, baseColor.B);
        }
    }

    public class Zone
    {
        public bool IsGap { get; set; }
        public ChartTrendLine Line { get; set; }
        public ChartRectangle Rectangle { get; set; }
        public List<ChartRectangle> Rectangles { get; set; }
    }


    [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class SIBI_BISI_SINGLE : Indicator
    {





        [Parameter("Min Size (Pips)", Group = "Average Spread", DefaultValue = 2, MinValue = 0, Step = 0.1)]
        public double GapMinSizePips { get; set; }

        [Parameter("Color", Group = "Average Spread", DefaultValue = "Lime")]
        public string GapColor { get; set; }

        [Parameter("Opacity", Group = "Average Spread", DefaultValue = 15, MinValue = 0, MaxValue = 255, Step = 1)]
        public double GapOpacity { get; set; }

        [Parameter("Remove History?", Group = "Average Spread")]
        public bool GapRemoveHistory { get; set; }

        [Parameter("Min Size (Pips)", Group = "Zone", DefaultValue = 0, MinValue = 0, Step = 0.1)]
        public double ZoneMinSizePips { get; set; }

        [Parameter("Break by wicks?", Group = "Zone")]
        public bool ZoneBreakByWicks { get; set; }

        [Parameter("Up Color", Group = "Zone", DefaultValue = "DodgerBlue")]
        public string ZoneUpColor { get; set; }

        [Parameter("Down Color", Group = "Zone", DefaultValue = "Magenta")]
        public string ZoneDownColor { get; set; }

        [Parameter("Opacity", Group = "Zone", DefaultValue = 30, MinValue = 0, MaxValue = 100, Step = 1)]
        public double ZoneOpacity { get; set; }

        [Parameter("Remove History?", Group = "Zone")]
        public bool ZoneRemoveHistory { get; set; }

        [Parameter("Thickness", Group = "Zone Line", DefaultValue = 1, MinValue = 0)]
        public int ZoneLineThickness { get; set; }

        [Parameter("Style", Group = "Zone Line", DefaultValue = LineStyle.Solid)]
        public LineStyle ZoneLineStyle { get; set; }

        [Parameter("Opacity", Group = "Zone Line", DefaultValue = 100, MinValue = 0, MaxValue = 255, Step = 1)]
        public double LineOpacity { get; set; }

        [Output("Results")]
        public IndicatorDataSeries Results { get; set; }

        public List<Zone> UpZones, DownZones;

        private int _index;
        private double _gapMinSize, _zoneMinSize;
        private Colors _colors;

        protected override void Initialize()
        {

            UpZones = new List<Zone>();
            DownZones = new List<Zone>();

            _gapMinSize = GapMinSizePips * Symbol.PipSize;
            _zoneMinSize = ZoneMinSizePips * Symbol.PipSize;
            _colors = new Colors 
            {
                GapZone = Colors.Get(GapColor, GapOpacity),
                GapLine = Colors.Get(GapColor, LineOpacity),
                UpZone = Colors.Get(ZoneUpColor, ZoneOpacity),
                UpLine = Colors.Get(ZoneUpColor, LineOpacity),
                DownZone = Colors.Get(ZoneDownColor, ZoneOpacity),
                DownLine = Colors.Get(ZoneDownColor, LineOpacity)
            };
        }

        public override void Calculate(int index)
        {

            if (index < 3)
                return;

            if (ZoneBreakByWicks)
                BreakZonesByBar(Bars[index]);

            if (_index < index)
            {
                _index = index;

                if (!ZoneBreakByWicks)
                    BreakZonesByBar(Bars[index - 1]);

                OnBarClosed(index - 1);
                BreakZonesByBar(Bars[index]);
            }


            Results[index] = double.NaN;
        }

        private void OnBarClosed(int index)
        {
            var bars = new[] 
            {
                Bars[index],
                Bars[index - 1],
                Bars[index - 2]
            };

            if (Math.Abs(bars[0].Open - bars[1].Close) >= _gapMinSize)
            {
                var max = Math.Max(bars[0].Open, bars[1].Close);
                var min = Math.Min(bars[0].Open, bars[1].Close);

                DrawGap("gap", index, min, max, bars[0].Close > (min + max) / 2);
            }

            if (bars[1].Low - bars[0].High >= _zoneMinSize)
            {
                DrawGap("a-down-zone", index, bars[0].High, bars[1].Low, false);
            }

            if (bars[2].Low - bars[0].High >= _zoneMinSize)
            {
                DrawGap("b-down-zone", index, bars[0].High, bars[2].Low, false);
            }

            if (bars[0].Low - bars[1].High >= _zoneMinSize)
            {
                DrawGap("a-up-zone", index, bars[1].High, bars[0].Low, true);
            }

            if (bars[0].Low - bars[2].High >= _zoneMinSize)
            {
                DrawGap("b-up-zone", index, bars[2].High, bars[0].Low, true);
            }
        }

        private void DrawGap(string tag, int index, double y1, double y2, bool isUpZone)
        {
            var isGap = tag.Contains("gap");

            var time1 = Bars[index].OpenTime;
            var time2 = Time.AddYears(100);

            Color zoneColor, lineColor;

            if (isGap)
            {
                zoneColor = _colors.GapZone;
                lineColor = _colors.GapLine;
            }
            else if (isUpZone)
            {
                zoneColor = _colors.UpZone;
                lineColor = _colors.UpLine;
            }
            else
            {
                zoneColor = _colors.DownZone;
                lineColor = _colors.DownLine;
            }

            tag = index + "_" + tag;

            var median = (y1 + y2) / 2;
            var line = Chart.DrawTrendLine("line_" + tag, time1, median, time2, median, lineColor, ZoneLineThickness, ZoneLineStyle);
            line.ExtendToInfinity = true;

            var zoneRect = Chart.DrawRectangle("zone_" + tag, time1, y1, time2, y2, zoneColor, 0);
            zoneRect.IsFilled = true;
            zoneRect.ZIndex = -100;

            var rect = Chart.DrawRectangle(tag, time1, y1, time2, y2, zoneColor, 0);
            rect.IsFilled = true;
            rect.ZIndex = -1;

            if (isUpZone)
            {
                UpZones.Add(new Zone 
                {
                    IsGap = isGap,
                    Line = line,
                    Rectangle = rect,
                    Rectangles = new List<ChartRectangle> 
                    {
                        zoneRect
                    }
                });
            }
            else
            {
                DownZones.Add(new Zone 
                {
                    IsGap = isGap,
                    Line = line,
                    Rectangle = rect,
                    Rectangles = new List<ChartRectangle> 
                    {
                        zoneRect
                    }
                });
            }
        }

        private void BreakZonesByBar(Bar bar)
        {
            var time = bar.OpenTime;
            var upBreakPrice = Math.Min(bar.Open, bar.Close);
            var downBreakPrice = Math.Max(bar.Open, bar.Close);

            foreach (var zone in UpZones.ToArray())
            {
                var breaker = !zone.IsGap && ZoneBreakByWicks ? bar.Low : upBreakPrice;
                var removeHistory = zone.IsGap ? GapRemoveHistory : ZoneRemoveHistory;

                if (zone.Rectangles[0].Y2 <= breaker)
                    continue;

                var rect = zone.Rectangles[0];
                rect.Time2 = time;

                if (rect.Y1 < breaker - _zoneMinSize + Symbol.TickSize)
                {
                    var newRect = Chart.DrawRectangle(rect.Name + "X", time, rect.Y1, time.AddYears(100), breaker, rect.Color, 0);
                    newRect.IsFilled = true;
                    newRect.ZIndex = -1;

                    zone.Rectangles.Insert(0, newRect);
                }
                else
                {
                    if (removeHistory)
                    {
                        zone.Rectangles.ForEach(x => Chart.RemoveObject(x.Name));
                        Chart.RemoveObject(zone.Line.Name);
                        Chart.RemoveObject(zone.Rectangle.Name);
                    }
                    else
                    {
                        zone.Line.Time2 = time;
                        zone.Line.ExtendToInfinity = false;

                        zone.Rectangles.Clear();
                        zone.Rectangle.Time2 = time;
                    }

                    UpZones.Remove(zone);
                }
            }

            foreach (var zone in DownZones.ToArray())
            {
                var breakPrice = !zone.IsGap && ZoneBreakByWicks ? bar.High : downBreakPrice;
                var removeHistory = zone.IsGap ? GapRemoveHistory : ZoneRemoveHistory;

                if (zone.Rectangles[0].Y1 >= breakPrice)
                    continue;

                var rect = zone.Rectangles[0];
                rect.Time2 = time;

                if (rect.Y2 > breakPrice + _zoneMinSize - Symbol.TickSize)
                {
                    var newRect = Chart.DrawRectangle(rect.Name + "X", time, breakPrice, time.AddYears(10), rect.Y2, rect.Color, 0);
                    newRect.IsFilled = true;
                    newRect.ZIndex = -1;

                    zone.Rectangles.Insert(0, newRect);
                }
                else
                {
                    if (removeHistory)
                    {
                        zone.Rectangles.ForEach(x => Chart.RemoveObject(x.Name));
                        Chart.RemoveObject(zone.Line.Name);
                        Chart.RemoveObject(zone.Rectangle.Name);
                    }
                    else
                    {
                        zone.Line.Time2 = time;
                        zone.Line.ExtendToInfinity = false;

                        zone.Rectangles.Clear();
                        zone.Rectangle.Time2 = time;
                    }

                    DownZones.Remove(zone);
                }
            }
        }
    }
}


EY
eyeballpaul

Joined on 07.11.2018

  • Distribution: Free
  • Language: C#
  • Trading platform: cTrader Automate
  • File name: SIBI _ BISI _ SINGLE.algo
  • Rating: 5
  • Installs: 5359
  • Modified: 06/11/2022 16:13
Comments
Log in to add a comment.
EP
EPOK · 4 months ago

Hi eyeballpaul , thx for your great indicator. Do u think it's possible to remove history when price tag the sibi or bisi only with a wick ? Actually the indicator need a candle body close outside the zone to remove the zone. Best regards

RI

Very useful

RI

Very nice.

Can you add show volume imbalance(VIM)?

EY
eyeballpaul · 2 years ago

Sorry guys recent updates from CT are breaking code. New version added .......................until next time

SE
seb.jandy · 2 years ago

Hi, i have same ISSUE cant get the indicator working. Any tips. tried the same settings as in the example. 

WI
Willie_Dladla · 2 years ago

Hello eyeballpaul , i have been looking for this indicator for while now. Thank you so much, but I'm having issues, when i apply it on my chart it doesn't show anything. Please help.

CT
ctid1744086 · 2 years ago

Awesome coding. Well done.