chart zoom keyboard

Created at 11 Dec 2023, 08:10
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
swingfish's avatar

swingfish

Joined 25.06.2016

chart zoom keyboard
11 Dec 2023, 08:10


hello, is there a way to zoom the charts to 30% or maybe 35% without using the mouse?

since they hotkeys go exponential, its hard to finetune zoom for defaults.

or another alternative would be a hotkey to reload the template with a certain zoom saved?

 

 


@swingfish
Replies

PanagiotisCharalampous
11 Dec 2023, 08:45

Hi swingfish,

It's not possible out of the box, but you could program this yourself. Here is an example how to do this with an indicator.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using cAlgo.API;
using cAlgo.API.Collections;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;

namespace cAlgo
{
    [Indicator(AccessRights = AccessRights.None, IsOverlay = true)]
    public class NewIndicator2 : Indicator
    {

        protected override void Initialize()
        {
            Chart.KeyDown += Chart_KeyDown;
        }

        private void Chart_KeyDown(ChartKeyboardEventArgs obj)
        {
           if(obj.Key == Key.Z)
           {
                Chart.ZoomLevel = 30;
           }
        }

        public override void Calculate(int index)
        {
            // Calculate value at specified index
            // Result[index] = 
        }
    }
}

You could program some custom levels using keys that you choose.

Best regards,

Panagiotis


@PanagiotisCharalampous