SwitchSymbol free

by Bart A in category Other at 14/11/2019
Description

The fastest way to switch between favourite symbols.
Symbols list can be set with input parameter separated by comma.

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
´╗┐using System;
using cAlgo.API;
using cAlgo.API.Internals;
using cAlgo.API.Indicators;
using cAlgo.Indicators;
using System.Linq;

namespace cAlgo
{
    [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class SwitchSymbol : Indicator
    {
        [Parameter("Symbols", DefaultValue = "EURUSD, GBPUSD, USDJPY, AUDUSD")]
        public string SymbolsText { get; set; }

        protected override void Initialize()
        {
            var symbolNames = SymbolsText.Split(new[] 
            {
                ','
            }).Select(s => s.Trim()).Where(s => string.IsNullOrWhiteSpace(s) == false).ToArray();

            var stackPanel = new StackPanel 
            {
                VerticalAlignment = VerticalAlignment.Top,
                HorizontalAlignment = HorizontalAlignment.Left,
                Margin = 8,
                Orientation = Orientation.Vertical
            };

            foreach (var symbolName in symbolNames)
            {
                var button = new Button 
                {
                    Text = symbolName,
                    Margin = 2,
                    IsEnabled = symbolName != SymbolName,
                    FontSize = 9
                };
                button.Click += Button_Click;
                stackPanel.AddChild(button);
            }

            Chart.AddControl(stackPanel);
        }

        private void Button_Click(ButtonClickEventArgs obj)
        {
            var symbolName = obj.Button.Text;
            Chart.TryChangeTimeFrameAndSymbol(TimeFrame, symbolName);
        }

        public override void Calculate(int index)
        {
        }
    }
}
Comments

Sharpie - November 17, 2019 @ 03:24

you are genius!!!! if you have time, do you mind to code automatic supply and demand zone that is widely use in MT4. I love executing trade in cTrader, unfortunately some of good chart indicators / scripts are only available in MT4. But with 3.6, I see great things to happen in cTrader.https://pasteboard.co/IH1YD6y.jpg

5