Supply/Demand Zones free

by cysecsbin.01 in category Trend at 03/07/2019
Description

Follow my cTrader Telegram group at https://t.me/cTraderCommunity; it's a new community but it will grow fast, plus everyone can talk about cTrader indicators and algorithm without restrictions, though it is not allowed to spam commercial indicators to sell them. There's also a Discord Server now @ https://discord.gg/5GAPMtp

This is a simple indicator requested from a user of the Telegram group; it shows supply and demand areas based on fractals and it's multi timeframe.

For any bug report or suggestion contact me by joining the telegram group linked above or by commenting below

Notification Publishing copyrighted material is strictly prohibited. If you believe there is copyrighted material in this section you may use the Copyright Infringement Notification form to submit a claim.
Formula / Source Code
Language: C#
Trading Platform: cAlgocTrader
´╗┐using System;
using cAlgo.API;
using cAlgo.API.Internals;
using cAlgo.API.Indicators;
using cAlgo.Indicators;
using System.Collections.Generic;

namespace cAlgo
{
    [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class SupplyandDemand : Indicator
    {
        [Parameter("Period", DefaultValue = 5)]
        public int per { get; set; }
        [Parameter("TimeFrame")]
        public TimeFrame tf { get; set; }

        [Parameter("Suplly Color", DefaultValue = "Red")]
        public string sColor { get; set; }
        [Parameter("Demand Color", DefaultValue = "Lime")]
        public string dColor { get; set; }

        [Parameter("Opacity %", DefaultValue = 20)]
        public int opt { get; set; }

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

        private MarketSeries series;
        private List<Supply> sList = new List<Supply>();
        private List<Demand> dList = new List<Demand>();
        private Color AsColor, AdColor;

        protected override void Initialize()
        {
            series = MarketData.GetSeries(tf);
            AsColor = Color.FromArgb((int)(255 * 0.01 * opt), Color.FromName(sColor).R, Color.FromName(sColor).G, Color.FromName(sColor).B);
            AdColor = Color.FromArgb((int)(255 * 0.01 * opt), Color.FromName(dColor).R, Color.FromName(dColor).G, Color.FromName(dColor).B);
        }

        public override void Calculate(int index)
        {
            var index2 = series.OpenTime.GetIndexByExactTime(MarketSeries.OpenTime[index]);
            var index3 = MarketSeries.OpenTime.GetIndexByExactTime(series.OpenTime[index2 - per]);

            bool s = true;
            bool t = true;

            //SUPPLY

            for (int i = 1; i < per; i++)
            {
                if (series.High[index2 - per + i] > series.High[index2 - per] && s == true)
                {
                    s = false;
                }
            }
            for (int i = 1; i < per; i++)
            {
                if (series.High[index2 - per - i] > series.High[index2 - per] && s == true)
                {
                    s = false;
                }
            }
            if (s == true)
            {
                sList.Add(new Supply(index3, series.High[index2 - per]));
            }

            //DEMAND

            for (int i = 1; i < per; i++)
            {
                if (series.Low[index2 - per + i] < series.Low[index2 - per] && t == true)
                {
                    t = false;
                }

            }
            for (int i = 1; i < per; i++)
            {
                if (series.Low[index2 - per - i] < series.Low[index2 - per] && t == true)
                {
                    t = false;
                }

            }
            if (t == true)
            {
                dList.Add(new Demand(index3, series.Low[index2 - per]));
            }


            if (!IsLastBar)
                return;

            //DRAWING

            foreach (var zone in sList)
            {
                for (int i = zone.index; i < index; i++)
                {
                    if (MarketSeries.High[i] > zone.high)
                    {
                        int fIndex = series.OpenTime.GetIndexByTime(MarketSeries.OpenTime[zone.index]);
                        Chart.DrawRectangle("supply" + zone.index + " " + i, zone.index, Math.Max(series.Close[fIndex], series.Open[fIndex]), i, zone.high, AsColor, 1).IsFilled = true;
                        break;
                    }
                }
            }

            foreach (var zone in dList)
            {
                for (int i = zone.index; i < index; i++)
                {
                    if (MarketSeries.Low[i] < zone.low)
                    {
                        int fIndex = series.OpenTime.GetIndexByTime(MarketSeries.OpenTime[zone.index]);
                        Chart.DrawRectangle("demand" + zone.index + " " + i, zone.index, Math.Min(series.Close[fIndex], series.Open[fIndex]), i, zone.low, AdColor, 1).IsFilled = true;
                        break;
                    }
                }
            }
        }
    }

    public class Supply
    {

        public int index;
        public double high;

        public Supply(int index, double high)
        {
            this.index = index;
            this.high = high;
        }

    }

    public class Demand
    {

        public int index;
        public double low;

        public Demand(int index, double low)
        {
            this.index = index;
            this.low = low;
        }

    }
}
Comments

tommchris7 - September 23, 2022 @ 09:43

1v1 lol is an important procedure for people who have had a previous implant device removed or replaced.

happypettimeofficial - December 31, 2022 @ 13:26

There are many places where you can find nail supplies. Here are a few options:

  1. Beauty supply stores: Many cities have stores that specialize in selling beauty products, including nail supplies. These stores may carry a wide range of products, including polish, acrylics, gel, and tools such as nail files and clippers.GUCCI nail art

  2. Online retailers: There are many online retailers that sell nail supplies, such as Amazon, Ulta, and Sally Beauty. You can browse through a wide selection of products and have them delivered to your door.

  3. Local salons: Many salons sell nail supplies to their clients. You can call and ask if they have the products you need in stock, and if so, you can purchase them directly from the salon.

  4. Specialty stores: Some cities have stores that specialize in selling nail supplies to professionals, such as nail technicians and salons. These stores may have a wider selection of products and may be able to offer bulk discounts for larger purchases.

  5. Trade shows: Nail Beauty trade shows and conferences often have vendors who sell nail supplies. Attending a trade show can be a great way to find new products and connect with other professionals in the industry.

 

Regenerate response

heineandersen85 - January 20, 2023 @ 11:21

I just downloaded this indicator, its like the zones are only painted if they have been consumed. It doesn't paint them forward, is it something wrong with my settings or?

0