Category Other  Published on 04/10/2019

Chart Interface Manager

Description

Hi All,

Here is a simple Ease of Life Bot to improve your interface management. It's purpose is to simply zoom in and out without having to manually adjust your Y-scale.


4x Parameters

#1 - Top of Range - defines the Top Y-value of that you wish to make visible. ie. AUDNZD set to 1.12

#2 - Bottom of Range - defines the Bottom Y-value that you wish to make visible. ie. AUDNZD set to 1.0

#3 - Range of View Percent - defines the percentage of the range that you wish to see while zoomed in. ie. 15 = 15%

#4 - Follow Ask/Bid - setting to "1" will cause the Chart to continually centre around the Ask/Bid lines. Anything else will turn Following off.


When the Bot starts, the chart will zoom in to show only the percentage of the chart you have set.

When the Bot is stopped, the chart will zoom out to show the entire Y-range that you have set. ie AUDNZD 1.0 - 1.12

 

I hope some of you find this usefull.

Enjoy!

Thoy1


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

namespace cAlgo.Robots
{
    [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class ChartZoomManager : Robot
    {
        [Parameter("Top of Range", DefaultValue = 1.18)]
        public double extremeHigh { get; set; }
        [Parameter("Bottom of Range", DefaultValue = 1.0)]
        public double extremeLow { get; set; }
        [Parameter("Range of View Percent", DefaultValue = 25)]
        public double rangePercentage { get; set; }
        [Parameter("Follow Ask/Bid? 1=On, 0=Off", DefaultValue = 1)]
        public double follow { get; set; }

        protected override void OnStart()
        {
            Chart.SetYRange(Symbol.Bid - ((extremeHigh - extremeLow) * (rangePercentage / 200)), Symbol.Bid + ((extremeHigh - extremeLow) * (rangePercentage / 200)));
        }

        protected override void OnTick()
        {
            if (follow == 1)
            {
                Chart.SetYRange(Symbol.Bid - ((extremeHigh - extremeLow) * (rangePercentage / 200)), Symbol.Bid + ((extremeHigh - extremeLow) * (rangePercentage / 200)));
            }
        }

        protected override void OnStop()
        {
            Chart.SetYRange(extremeLow - ((extremeHigh - extremeLow) * 0.1), extremeHigh + ((extremeHigh - extremeLow) * 0.1));
        }
    }
}


TH
thoy1

Joined on 15.02.2018

  • Distribution: Free
  • Language: C#
  • Trading platform: cTrader Automate
  • File name: Chart Zoom Manager.algo
  • Rating: 0
  • Installs: 1371
Comments
Log in to add a comment.
No comments found.