cTrader Scalpers Buddy free

Description

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.

INDICATOR PARAMETER

 

CURRENT FEATURES

  • 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
Emailcontact@clickalgo.com
Phone: (44) 203 289 6573
Websitehttps://clickalgo.com

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
// -------
// PURPOSE
// -------
// 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; }

        #endregion

        #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;

        #endregion

        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()
        {
            try
            {
                // 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;
                    break;
                case 2:
                    position = StaticPosition.TopCenter;
                    break;
                case 3:
                    position = StaticPosition.TopRight;
                    break;
                case 4:
                    position = StaticPosition.Right;
                    lowerPosition = "\n\n";
                    break;
                case 5:
                    position = StaticPosition.BottomRight;
                    lowerPosition = "\n\n";
                    break;
                case 6:
                    position = StaticPosition.BottomCenter;
                    lowerPosition = "\n\n";
                    break;
                case 7:
                    position = StaticPosition.BottomLeft;
                    lowerPosition = "\n\n";
                    break;
                case 8:
                    position = StaticPosition.Left;
                    lowerPosition = "\n\n";
                    break;
                default:
                    position = StaticPosition.TopLeft;
                    break;
            }
        }

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

            // 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)
                        Notifications.PlaySound(MediaFile);
                }
            }
            else
            {
                ChartObjects.RemoveObject("alertMsg");
            }

            // 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);
            }
        }

        #endregion

        #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);
        }

        #endregion
    }
}
Comments