Free tool

Partial Close Buttons cBot for cTrader

A small, focused cBot for intraday index traders who want clean, repeatable partial exits in cTrader without typing volumes in a popup on every decision.

What this cBot does

This cBot adds three simple buttons to your cTrader chart for the current symbol:

  • Close 25% of the current position
  • Close 50% of the current position
  • Close 75% of the current position

Each click closes that percentage of the remaining volume on the position it is acting on. So if you click 50% three times, you are consistently halving what is left, not referring back to the original size.

No trade entries, no signals, no automation of your strategy. It only helps you scale out in a clean and mechanical way.

Partial Close Buttons cBot in cTrader

How it fits into my trading

I use this cBot on index CFDs like DAX and FTSE. My style is simple:

  • I do not hedge in cTrader.
  • If there are two positions, I have added 100% on top of a winner.
  • If the addon is wrong, I close the addon completely.

In that context, I want partial exits to be fast and consistent: trim risk without guessing volumes, scale out while a trade is working, and avoid fighting UI popups when the market is moving.

How it behaves with multiple positions

The cBot always works on one position at a time:

  • It looks at all open positions for the current symbol in cTrader.
  • It acts on the first position for that symbol (typically the oldest trade, your base position).
  • Each button press applies the selected percentage to the current size of that position.
  • If the remaining size drops below the broker’s minimum volume step, it stops closing and leaves the small remainder.

In a non-hedging, “skyscraper” add-on style, this is predictable: the base position is reduced step by step, and only once it is gone will the next position be touched.

Want direct help?

If you want to review your scaling, trade management, or DAX/FTSE intraday approach, you can book a free intro call or a 1 hour mentorship session on the mentorship page.

Go to mentorship and booking

How to install and run it in cTrader

  • Open cTrader and go to the Automate tab.
  • Create a new cBot.
  • Delete the template code and paste the code from the section below.
  • Click Build to compile.
  • Go back to the Trade tab and open the chart for your symbol (for example DAX or FTSE).
  • Attach the cBot to that chart and click Start.
  • You will see three buttons at the top of the chart: Close 25%, Close 50%, Close 75%.
How to use it in practice
  • Use it on symbols where you already have a clear plan for entries, stops, and maximum risk per trade.
  • When a position is in profit and you want to reduce risk or lock something in, use the buttons instead of manually typing size.
  • Remember that each click acts on the remaining volume of the position it is attached to, not on your total account exposure.
What this cBot is not

This is not a trading system and not a signal generator. It does not decide when to enter or exit. It is a small utility for traders who already have a process and simply want faster, more disciplined partial closes.

Show full cTrader cBot code (copy & paste into Automate)
using cAlgo.API;

namespace cAlgo
{
    [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class PartialCloseButtons : Robot
    {
        private Button _btn25;
        private Button _btn50;
        private Button _btn75;

        protected override void OnStart()
        {
            var panel = new StackPanel
            {
                Orientation = Orientation.Horizontal,
                HorizontalAlignment = HorizontalAlignment.Right,
                VerticalAlignment = VerticalAlignment.Top,
                Margin = 5
            };

            _btn25 = CreateButton("Close 25%");
            _btn50 = CreateButton("Close 50%");
            _btn75 = CreateButton("Close 75%");

            _btn25.Click += e => CloseFraction(0.25);
            _btn50.Click += e => CloseFraction(0.50);
            _btn75.Click += e => CloseFraction(0.75);

            panel.AddChild(_btn25);
            panel.AddChild(_btn50);
            panel.AddChild(_btn75);

            Chart.AddControl(panel);
        }

        private Button CreateButton(string text)
        {
            return new Button
            {
                Text = text,
                Width = 80,
                Height = 24,
                Margin = 2,
                Opacity = 0.85
            };
        }

        private void CloseFraction(double fraction)
        {
            var position = GetSymbolPosition();
            if (position == null)
            {
                Print("No open position on {0}", SymbolName);
                return;
            }

            var currentVolume = position.VolumeInUnits;
            if (currentVolume <= 0)
                return;

            var step = Symbol.VolumeInUnitsStep;

            // calculate volume to close as X% of current, aligned to step
            var raw = currentVolume * fraction;
            var volumeToClose = (long)(raw / step) * step;

            if (volumeToClose < step)
            {
                Print("Volume to close ({0}) is below step ({1}), nothing done.", volumeToClose, step);
                return;
            }

            ClosePositionAsync(position, volumeToClose, result =>
            {
                if (!result.IsSuccessful)
                    Print("Partial close error: {0}", result.Error);
            });
        }

        private Position GetSymbolPosition()
        {
            foreach (var pos in Positions)
            {
                if (pos.SymbolName == SymbolName)
                    return pos;
            }

            return null;
        }

        protected override void OnStop()
        {
            // Controls are removed when the cBot stops
        }
    }
}
Disclaimer: This software is provided “as is”, with no guarantees, no warranties, and no promise it still compiles or behaves the same after platform updates. Personal use only. All rights reserved. Redistribution or modification requires my explicit written consent.

This cBot provides no trading signals, no financial advice, and no guarantee of accuracy or suitability. You are fully responsible for your own trading decisions, execution, and risk.