Category Trend  Published on 10/01/2024

Demand Supply Volume Squeeze indicator

Description

This indicator shows future respected Support and Resistance levels based on the range of previous Demand and Supply bars, occurring as Volume squeeze size. 

This custom indicator was developed by Iba and is dedicated to his memory.


using System;
using cAlgo.API;
using cAlgo.API.Internals;
using cAlgo.API.Indicators;
using cAlgo.Indicators;

namespace cAlgo
{
    [Cloud("outZoneUp", "outZoneDn", FirstColor = "Black", SecondColor = "Red", Opacity = 0.05)]
    [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class mSPSDvolume : Indicator
    {
        [Parameter("Period (10)", DefaultValue = 10)]
        public int inpPeriod1 { get; set; }
        [Parameter("Period (20)", DefaultValue = 20)]
        public int inpPeriod2 { get; set; }
        [Parameter("Period (50)", DefaultValue = 50)]
        public int inpPeriod3 { get; set; }
        [Parameter("Period (100)", DefaultValue = 100)]
        public int inpPeriod4 { get; set; }
        [Parameter("Period (200)", DefaultValue = 200)]
        public int inpPeriod5 { get; set; }

        [Output("outZoneUp", LineColor = "Silver", PlotType = PlotType.Line, Thickness = 1)]
        public IndicatorDataSeries outZoneUp { get; set; }
        [Output("outZoneDn", LineColor = "Silver", PlotType = PlotType.Line, Thickness = 1)]
        public IndicatorDataSeries outZoneDn { get; set; }
        
        private mMFIFIRgap _i1, _i2, _i3, _i4, _i5;
        private IndicatorDataSeries _pos, _neg, _pol;
        

        protected override void Initialize()
        {
            _i1 = Indicators.GetIndicator<mMFIFIRgap>(inpPeriod1);
            _i2 = Indicators.GetIndicator<mMFIFIRgap>(inpPeriod2);
            _i3 = Indicators.GetIndicator<mMFIFIRgap>(inpPeriod3);
            _i4 = Indicators.GetIndicator<mMFIFIRgap>(inpPeriod4);
            _i5 = Indicators.GetIndicator<mMFIFIRgap>(inpPeriod5);
            _pos = CreateDataSeries();
            _neg = CreateDataSeries();
            _pol = CreateDataSeries();
        }

        public override void Calculate(int i)
        {
            _pos[i] = _neg[i] = 0;
            
            _pos[i] += _i1.outBulls[i] == +2 ? +1 : 0;
            _pos[i] += _i2.outBulls[i] == +2 ? +1 : 0;
            _pos[i] += _i3.outBulls[i] == +2 ? +1 : 0;
            _pos[i] += _i4.outBulls[i] == +2 ? +1 : 0;
            _pos[i] += _i5.outBulls[i] == +2 ? +1 : 0;

            _neg[i] += _i1.outBears[i] == -2 ? -1 : 0;
            _neg[i] += _i2.outBears[i] == -2 ? -1 : 0;
            _neg[i] += _i3.outBears[i] == -2 ? -1 : 0;
            _neg[i] += _i4.outBears[i] == -2 ? -1 : 0;
            _neg[i] += _i5.outBears[i] == -2 ? -1 : 0;
            
            _pol[i] =     _pos[i] == +5 ? +5 
                        : _neg[i] == -5 ? -5
                        : 0;
                        
            outZoneUp[i] = _pos[i] == 0 && _neg[i] == 0 ? Bars.HighPrices[i] : outZoneUp[i-1];
            outZoneDn[i] = _pos[i] == 0 && _neg[i] == 0 ? Bars.LowPrices[i] : outZoneDn[i-1];
        }
    }
}

mfejza's avatar
mfejza

Joined on 25.01.2022

  • Distribution: Free
  • Language: C#
  • Trading platform: cTrader Automate
  • File name: mSPSDvolume.algo
  • Rating: 5
  • Installs: 1381
  • Modified: 10/01/2024 00:08
Comments
Log in to add a comment.
FE
fernando.web1001trader · 7 months ago

Estou testando assim que tiver uma posição eu posto

JA
jaime999jm007 · 10 months ago

Eyy i cant instal the bot because a old version of Ctrader, but wen i copy the code, it dosent compound becuase of mMFIFIRgap indicator its missing the reference. If u have this indicator so i can connect please!!