cTrader Scalpers Buddy free

by ClickAlgo in category Volatility at 13/03/2015

The cTrader Scalpers Buddy will inform the trader with a message and sound when high volatility occurs, it will also display the current spread and total depth of market volume for the buyers and sellers. 

Depth of Market

The Depth of Market is the total of all volume as shown below:

Volatility Alert with Warning Sound

Volatility Message With No Alert


You can show both the volatility and spread or just spread or just volatility, this can be selected from the parameters below.




  • Configure the volatility depending on your scalping requirements.
  • Sound alert, configurable on/off.
  • Position warning message anywhere on the screen.
  • Configure colour of warning text to suit your background colour.
  • Option to display actual volatility amount in pips to be shown with the message to show price movement
  • Show or hide volatility message
  • Show or hide the current bid/ask spread size.
  • Show or Hide Depth of Market (total)
  • Configure the colour of the current spread size text.

* Use this Indicator with the Market Trading Clock /algos/indicators/show/687 to manage volatility when an exchange opens.

Some brokers do not provide real DoM and have their volumes fixed.


Paul Hayes
Sales & Marketing
Phone: (44) 203 289 6573

Twitter | Facebook | YouTube | Pinterest | LinkedIn

PS: Why not join our instant chat group on Telegram.


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
// -------
// -------
// Alerts user when there is high volatility in the market over a period of seconds.
// Userful signal when not looking at charts or when not at computer, configurable audible sound alerts for each currency.
// Good for scalping.

// Author: Paul Hayes    
// Date:   24/12/2015
// Version 1.5
// Coding Guidlines: https://github.com/dotnet/corefx/wiki/Framework-Design-Guidelines-Digest
// Bug fix: display formatting issue.

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

namespace cAlgo
    [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class ScalpersBuddy : Indicator
        #region user defined parameters

        [Parameter("Alert ON", DefaultValue = true)]
        public bool AlertOn { get; set; }

        [Parameter("Sound ON", DefaultValue = true)]
        public bool PlaySound { get; set; }

        [Parameter("Volatility Pips", DefaultValue = 10, MaxValue = 20, MinValue = 1)]
        public int VolatilityPips { get; set; }

        [Parameter("Media File", DefaultValue = "c:\\windows\\media\\notify.wav")]
        public string MediaFile { get; set; }

        [Parameter("Display Position, 1-8", DefaultValue = 2, MinValue = 1, MaxValue = 3)]
        public int WarningPostion { get; set; }

        [Parameter("Warning Color", DefaultValue = "Red")]
        public string WarningColor { get; set; }

        [Parameter("Show Volatility", DefaultValue = true)]
        public bool ShowVolatility { get; set; }

        [Parameter("Show Spread", DefaultValue = true)]
        public bool ShowSpread { get; set; }

        [Parameter("Show Depth of Market", DefaultValue = true)]
        public bool ShowDepthOfMarket { get; set; }

        [Parameter("Spread Color", DefaultValue = "White")]
        public string SpreadColor { get; set; }


        #region Private properties

        private MarketSeries mSeries;
        private StaticPosition position;
        private Colors warningTextColor;
        private Colors spreadTextColor;
        private bool errorOccured = false;
        private string lowerPosition = string.Empty;
        private MarketDepth marketDepth;


        const string errorMsg = "\n\n\n\n\n Scalpers Buddy Indicator: An error has occurred, view log events window for more information.";

        #region cTrader Events

        protected override void Initialize()
                // Get the time-frame series of data
                mSeries = MarketData.GetSeries(Symbol, TimeFrame.Minute);
                warningTextColor = (Colors)Enum.Parse(typeof(Colors), WarningColor, true);
                spreadTextColor = (Colors)Enum.Parse(typeof(Colors), SpreadColor, true);

                if (ShowDepthOfMarket)
                    //  Get Market Depth
                    marketDepth = MarketData.GetMarketDepth(Symbol);

                    // subscribe to event Updated
                    marketDepth.Updated += MarketDepthUpdated;

            } catch (Exception e)
                errorOccured = true;
                Print("Scalpers Buddy: " + e.Message);

            // position alert message on screen
            switch (WarningPostion)
                case 1:
                    position = StaticPosition.TopLeft;
                case 2:
                    position = StaticPosition.TopCenter;
                case 3:
                    position = StaticPosition.TopRight;
                case 4:
                    position = StaticPosition.Right;
                    lowerPosition = "\n\n";
                case 5:
                    position = StaticPosition.BottomRight;
                    lowerPosition = "\n\n";
                case 6:
                    position = StaticPosition.BottomCenter;
                    lowerPosition = "\n\n";
                case 7:
                    position = StaticPosition.BottomLeft;
                    lowerPosition = "\n\n";
                case 8:
                    position = StaticPosition.Left;
                    lowerPosition = "\n\n";
                    position = StaticPosition.TopLeft;

        public override void Calculate(int index)
            if (errorOccured)
                ChartObjects.DrawText("error-label", errorMsg, StaticPosition.TopCenter, Colors.Red);

            // get the last highest price value
            double high = (mSeries.High.LastValue);
            // get the last lowest price value
            double low = (mSeries.Low.LastValue);

            // difference between high and low divided by the current instruments pip size = sudden movement in pips
            double pips = (high - low) / Symbol.PipSize;

            string pipsVolatility = "(Volatility: " + pips.ToString("0.00") + " pips)";

            // display error message to screen.
            if (ShowVolatility)
                ChartObjects.DrawText("volatilityMsg", pipsVolatility += lowerPosition, position, spreadTextColor);

            // if pip movement > volatility setting 
            if (Math.Ceiling(pips) > VolatilityPips)
                if (AlertOn)
                    ChartObjects.DrawText("alertMsg", pipsVolatility, position, warningTextColor);

                if (PlaySound)
                    if (MediaFile != string.Empty)

            // if user wants to see the current bid/ask spread size, * feature separate from volatility alert.
            if (ShowSpread)
                var spread = Math.Round(Symbol.Spread / Symbol.PipSize, 2);
                string s = string.Format("{0:N2}", spread);

                ChartObjects.DrawText("spreadMsg", "\nSpread: " + s, position, spreadTextColor);


        #region market depth

        private void MarketDepthUpdated()
            double bidVolume = 0;
            double askVolume = 0;

            foreach (var entry in marketDepth.BidEntries)
                double dVolume = Math.Round(entry.Volume / 1000000.0, 2);
                bidVolume += dVolume;

            foreach (var entry in marketDepth.AskEntries)
                double dVolume = Math.Round(entry.Volume / 1000000.0, 2);
                askVolume += dVolume;

            ChartObjects.DrawText("Bid", "\n\n\nBuyers: " + bidVolume.ToString() + "m", position, Colors.Green);
            ChartObjects.DrawText("ask", "\n\nSellers: " + askVolume.ToString() + "m", position, Colors.Red);


GoldnOil - March 14, 2015 @ 22:39

Hi !

Can you add "user comments" to your code above.  will be useful to understand and give feedback on its working.



ClickAlgo - March 15, 2015 @ 19:38

Hi SKhan,


I will have it ready by Monday, it would be good if anybody could correct the logic if incorrect so that we have a good working tool for all to use, I am new to this industry and the cAlgo object model, so still learning its features.


ClickAlgo - March 16, 2015 @ 06:36


As promised an updated version of this indicator has been uploaded together with additional error handling and a code clean up.


ClickAlgo - March 16, 2015 @ 07:50

NEW FEATURE: Show the current bid/ask spread size in pips on screen.

ClickAlgo - April 19, 2015 @ 11:48

Update: Fixed the overlapping of displayed text when set in different positions

ClickAlgo - April 24, 2015 @ 07:30

Update: Removed sound alert feature as this caused cTrader to freeze.

ClickAlgo - April 28, 2015 @ 18:26

Sound alert re-added, after investigation it was found that this indicator did not freeze the platform.

TRADER100D1M - May 11, 2015 @ 02:34

I'm testing the indicator, thank you

TRADER100D1M - May 11, 2015 @ 14:20

Good morning, you have an indicator of reports that shows in the corner at the discretion of news and importance. Thank You Note: you can create it with the great quality of its indicators. SUCCESS for you

ClickAlgo - May 11, 2015 @ 17:18

I could try and create an indicator that shows the next news release with importance and previous, consensus and actual result, this what you want?


TRADER100D1M - May 12, 2015 @ 06:49

Yes it would be great because then I would know the moment the news instance time left for her to leave

ClickAlgo - May 12, 2015 @ 19:01

ok, i will try and add this as an optional feature

ClickAlgo - May 13, 2015 @ 09:40

Hi trader100D1M,

you may want to use the dailyFX news release indicator, its very good and does what you want.



dimiaverilla - November 15, 2015 @ 06:20

Brilliant work mate. Thank you.

ClickAlgo - December 24, 2015 @ 12:32

Update: Depth of market added, thanks to idea by Dimi

dimiaverilla - December 30, 2015 @ 06:58

Thanks Paul. This is one indicator I can't go without now. You're a champ.

Jiri Beloch - January 10, 2016 @ 22:19

I haven't tried this indicator but doesn't it spam emails with each tick when higher than defined volatility?

ClickAlgo - January 11, 2016 @ 08:38

The idea was that it would send an email to the address you specify in the parameters of the indicator warning of high volatility on an instrument, so it is not spam.

But thank you for bringing the multiple emails to my attention, I have now removed the email feature as it was just a nice to have.

Serpico - September 28, 2016 @ 08:24

Hello Mr Paul.


Thanks for all your contributions to this comunity, Im not getting any accurate readings or data of market depth on Pepperstone



DelTrader - January 20, 2018 @ 23:36


first of all, congratulations, awesome indicator.

I tried to make a change but i cant and i need your help.

The idea is if Buyers are superior to sellers, highlight buyers 'color, for example, it stays green and sellers' color is gray.

Can you help me with the code? i cant make IF structure because are difrent methods and i dont know convert.

Thank you

DelTrader - January 21, 2018 @ 23:38

Solved .