Category Other  Published on 05/08/2021

DeMark 9

Description

Indicator 9, invented by Tom DeMark.

Web page: https://demark.com/demark-indicators/793

Article: https://www.protradingschool.com/tom-demark-indicators/

Video: The "MAGIC" Indicator that Shows You Exactly WHEN to BUY and SELL
https://youtu.be/upk12YhcilU

Video: TD Sequential - A Comprehensive Introduction for Mastering Market Dynamics
https://www.youtube.com/watch?v=2hk8YeYKNmI

This indicator shows the tops and bottoms of the market, before a price reversion, with buy signals (green) and sell signals (red).
The indicator does not repaint signals.
You can use it in any market, in any timeframe.
Usually the signals appear in clusters of several consecutive signals.

Pros:
- The indicator does not have parameters to adjust.
- The indicator does not repaint signals.
- Many times the indicator spots very well the tops and bottoms of the market, just before a price reversion.

Cons:
- Not all tops and bottoms are signaled.
- There are false signals when a strong trend develops. It is not possible to know in advance when a signal is false.
- The indicator does not tell if the reversion ahead is going to be large or small.

Parameters:
Display:
Cluster of signals:

  • ALL SIGNALS -- all signals of the cluster are shown.
  • FIRST SIGNAL -- only the first signal of the cluster is shown.

Show only:

  • ALL SIGNALS -- all signals are shown.
  • PERFECTED SIGNALS -- only perfected signals are shown. Warning: there is no evidence that perfected signals are any better than other signals.

Alarm:
Optionally, the indicator can play a notification alarm every time a new signal appears. 

If you manage to trade profitably with this indicator or you figure out how to avoid false signals please share your experience in the comments or in the email address <testuality at gmail dot com>.

 

 

 


/*
Indicator DeMark 9

Web page:
https://demark.com/demark-indicators/793

Article:
https://www.protradingschool.com/tom-demark-indicators/

Video: The "MAGIC" Indicator that Shows You Exactly WHEN to BUY and SELL
https://youtu.be/upk12YhcilU

Video: TD Sequential - A Comprehensive Introduction for Mastering Market Dynamics
https://www.youtube.com/watch?v=2hk8YeYKNmI

This indicator shows the tops and bottoms of the market, before a price reversion.
The indicator does not repaint signals.
You can use it in any market, in any timeframe.
Usually the signals appear in clusters of several consecutive signals.

Pros:
- The indicator does not have parameters to adjust.
- The indicator does not repaint signals.
- Many times the indicator spots very well the tops and bottoms of the market, just before the price reversion.

Cons:
- Not all tops and bottoms are signaled.
- There are false signals when a strong trend develops. It is not possible to know in advance when a signal is false.
- The indicator does not tell if the reversion ahead is going to be large or small.

Parameters:
Display:
Cluster of signals:
ALL SIGNALS -- all signals of the cluster are shown.
FIRST SIGNAL -- only the first signal of the cluster is shown.

Show only:
ALL SIGNALS -- all signals are shown.
PERFECTED SIGNALS -- only perfected signals are shown. Warning: there is no evidence that perfected signals are any better that other signals.

Alarm:
Optionally, it can play a notification alarm every time a new signal appears. 



Log 
2021-8-5
-- Created first version

*/
using System;
using cAlgo.API;
using cAlgo.API.Indicators;

namespace cAlgo.Indicators
{
    [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class DeMark9 : Indicator
    {
        [Parameter("Cluster of signals", Group = "Display", DefaultValue = ClusterType.ALL_SIGNALS)]
        public ClusterType ParamClusterType { get; set; }

        [Parameter("Show only", Group = "Display", DefaultValue = SignalType.ALL_SIGNALS)]
        public SignalType ParamSignalType { get; set; }

        [Parameter("Play sound on new signal", Group = "Alarm", DefaultValue = false)]
        public bool ParamNotify { get; set; }

        [Parameter("Sound file", Group = "Alarm", DefaultValue = "C:/windows/media/notify.wav")]
        public string ParamAlarmFile { get; set; }

        [Output("Buy signal", LineColor = "Green", PlotType = PlotType.Points, Thickness = 5)]
        public IndicatorDataSeries BuySignal { get; set; }

        [Output("Sell signal", LineColor = "Red", PlotType = PlotType.Points, Thickness = 5)]
        public IndicatorDataSeries SellSignal { get; set; }


        private AverageTrueRange atr;

        protected override void Initialize()
        {
            Bars.BarOpened += OnBarOpened;
            this.atr = Indicators.AverageTrueRange(Math.Min(200, Bars.Count - 1), MovingAverageType.Simple);
        }

        private void OnBarOpened(BarOpenedEventArgs args)
        {
            if (this.ParamNotify && this.ParamAlarmFile != null && this.ParamAlarmFile.Length > 0 && (!double.IsNaN(BuySignal.Last(1)) || !double.IsNaN(SellSignal.Last(1))))
            {
                Notifications.PlaySound(this.ParamAlarmFile);
            }
        }

        public override void Calculate(int index)
        {
            BuySignal[index] = double.NaN;
            SellSignal[index] = double.NaN;
            if (index > 20)
            {
                bool buyCondition = true;
                bool sellCondition = true;

                if (this.ParamClusterType == ClusterType.FIRST_SIGNAL)
                {
                    for (int i = index - 8; sellCondition && i < index; i++)
                    {
                        if (!double.IsNaN(SellSignal[i]))
                        {
                            sellCondition = false;
                        }
                    }
                    for (int i = index - 8; buyCondition && i < index; i++)
                    {
                        if (!double.IsNaN(BuySignal[i]))
                        {
                            buyCondition = false;
                        }
                    }
                }

                for (int i = index - 8; sellCondition && i <= index; i++)
                {
                    if (Bars.ClosePrices[i - 4] >= Bars.ClosePrices[i])
                    {
                        sellCondition = false;
                    }
                }


                for (int i = index - 8; buyCondition && i <= index; i++)
                {
                    if (Bars.ClosePrices[i - 4] <= Bars.ClosePrices[i])
                    {
                        buyCondition = false;
                    }
                }

                if (buyCondition)
                {
                    switch (this.ParamSignalType)
                    {
                        case SignalType.ALL_SIGNALS:
                            BuySignal[index] = Bars.LowPrices[index] - 2 * this.atr.Result.LastValue;
                            break;
                        case SignalType.PERFECTED_SIGNALS:
                            if (Bars.LowPrices[index] <= Bars.LowPrices[index - 2] && Bars.LowPrices[index] <= Bars.LowPrices[index - 3])
                            {
                                BuySignal[index] = Bars.LowPrices[index] - 2 * this.atr.Result.LastValue;
                            }
                            break;
                    }
                }

                if (sellCondition)
                {
                    switch (this.ParamSignalType)
                    {
                        case SignalType.ALL_SIGNALS:
                            SellSignal[index] = Bars.HighPrices[index] + 2 * this.atr.Result.LastValue;
                            break;
                        case SignalType.PERFECTED_SIGNALS:
                            if (Bars.HighPrices[index] >= Bars.HighPrices[index - 2] && Bars.HighPrices[index] >= Bars.HighPrices[index - 3])
                            {
                                SellSignal[index] = Bars.HighPrices[index] + 2 * this.atr.Result.LastValue;
                            }
                            break;
                    }
                }
            }
        }

    }

    public enum SignalType
    {
        ALL_SIGNALS,
        PERFECTED_SIGNALS
    }

    public enum ClusterType
    {
        ALL_SIGNALS,
        FIRST_SIGNAL
    }
}


GU
guillermo

Joined on 07.06.2019

  • Distribution: Free
  • Language: C#
  • Trading platform: cTrader Automate
  • File name: DeMark9.algo
  • Rating: 5
  • Installs: 3896
Comments
Log in to add a comment.
CT
ctid5020674 · 1 week ago

hey thanks for the indicator, the alarm sound is not working for me tho. any idea why?