Single robot that turns off all other robots

Created at 16 Nov 2015, 14:46
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!
TR

TraderM

Joined 30.12.2012

Single robot that turns off all other robots
16 Nov 2015, 14:46


Hi,

I would like to have a single robot that turns off all other robots, for example if the account balance goes under a certain level.

I would prefer a single robot because:

- no code redundancy, functionality is centralised and only has to run in one instance

- parameters only have to be set once, which is less prone to user error

- I could attach this single robot to a faster time frame (OnTick or 5M OnBar) rather than to the one which my robots currently use (Hourly OnBar). (If I have to code this in all my instances OnTick, then this would seriously increase required resources and impact performance.)

I found an old thread in the Suggestions part of the Forum (/forum/suggestions/1475)...I guess this hasn't been implemented, has it? Or is there an alternative solution?

Thanks!

TraderM

 

 


@TraderM
Replies

mindbreaker
16 Nov 2015, 15:35

:)

TraderM said:

Hi,

I would like to have a single robot that turns off all other robots, for example if the account balance goes under a certain level.

I would prefer a single robot because:

- no code redundancy, functionality is centralised and only has to run in one instance

- parameters only have to be set once, which is less prone to user error

- I could attach this single robot to a faster time frame (OnTick or 5M OnBar) rather than to the one which my robots currently use (Hourly OnBar). (If I have to code this in all my instances OnTick, then this would seriously increase required resources and impact performance.)

I found an old thread in the Suggestions part of the Forum (/forum/suggestions/1475)...I guess this hasn't been implemented, has it? Or is there an alternative solution?

Thanks!

TraderM

 

 

Hello,

In one cBot create file or folder

in other cbots check if file or folder exist if exist then stop the cbot

Nice day


@mindbreaker

kricka
17 Nov 2015, 22:33

A revival!

mindbreaker,

seems to be a revival of stop other robots from a main robot, like that!

Its definitely a hot issue and hope for a solution and a function from Spotware on this subject. 


@kricka

mindbreaker
20 Nov 2015, 16:32

:D

OR Close cAlgo from C# :D


@mindbreaker

ClickAlgo
20 Nov 2015, 17:20

I have a web interface where I can access on any device's web browser showing the status of my robots running on a VPS. I can then pause, stop or re-start them from a smart phone, tablet or desktop.

You can implement a simpler solution by storing the state of the robot somewhere on the local machine and reading this state from your robots.

In the future I maybe Spotware will build this functionality into the platform so that non-programmers have more control, but it may need a 3rd party plug-in to be used until they do.

Is there only a few people interested in this feature or is there many?


@ClickAlgo

mindbreaker
20 Nov 2015, 18:26

Close cAlgo from c#
using System;
using System.Linq;
using cAlgo.API;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;
using cAlgo.Indicators;

namespace cAlgo
{
    [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.FullAccess)]
    public class Boom : Robot
    {
        [Parameter(DefaultValue = 0.0)]
        public double Parameter { get; set; }

        protected override void OnStart()
        {
            // Put your initialization logic here
        }

        protected override void OnTick()
        {
            // Put your core logic here
            Print("CLose cAlgo");
            System.Environment.Exit(1);
        }

        protected override void OnStop()
        {
            // Put your deinitialization logic here
        }
    }
}

CLose cAlgo platform :P


@mindbreaker

kricka
21 Nov 2015, 03:42

Excellent idea

Paul_Hayes said:

I have a web interface where I can access on any device's web browser showing the status of my robots running on a VPS. I can then pause, stop or re-start them from a smart phone, tablet or desktop.

You can implement a simpler solution by storing the state of the robot somewhere on the local machine and reading this state from your robots.

In the future I maybe Spotware will build this functionality into the platform so that non-programmers have more control, but it may need a 3rd party plug-in to be used until they do.

Is there only a few people interested in this feature or is there many?

Hi Paul_Hayes,

It sounds like an excellent idea to have this control on cBots running on a VPS from a web interface. We are still in the very early stages and in the beginning of a revolution when it comes to trading platforms, VPS and the external control by the retail traders. W10, Android, Linux and other OS will bring this forward on small devices like small computer devices, tablets and cell phones. Your idea is great and hope you will be working on it and bring it forward.


@kricka

mindbreaker
21 Nov 2015, 11:45

RE: Excellent idea

This post was removed by moderator.


@mindbreaker

kricka
22 Nov 2015, 00:06

Work together

This post was removed by moderator.

 


@kricka

TraderM
22 Nov 2015, 15:05

My solution

Hi Everyone,

thanks for the input. It is good to see other people are interested in this too.

In the short-term I will create a seperate robot that:

- checks balance, then if necessary

- deletes pending orders

- closes positions

- close cAlgo (as mindbreaker suggests above)

It seems a bit harsh to close cAlgo, but this is a solution and not too difficult to implement.

Maybe in the future there could be an account protection feature added to the platform, a type of airbag, which performs these actions if balance gets too low.

Thanks for you help and input!

TraderM


@TraderM

Spotware
23 Nov 2015, 02:56

Dear Traders,

Thank you all for your suggestion. We will consider it. Additionally, you can vote for it in: http://vote.spotware.com/forums/229166-ideas-and-suggestions-for-ctrader-and-calgo/suggestions/5498070-ability-to-stop-other-cbots-from-the-main-cbot


@Spotware

mindbreaker
23 Nov 2015, 10:56

RE: My solution

TraderM said:

Hi Everyone,

thanks for the input. It is good to see other people are interested in this too.

In the short-term I will create a seperate robot that:

- checks balance, then if necessary

- deletes pending orders

- closes positions

- close cAlgo (as mindbreaker suggests above)

It seems a bit harsh to close cAlgo, but this is a solution and not too difficult to implement.

Maybe in the future there could be an account protection feature added to the platform, a type of airbag, which performs these actions if balance gets too low.

Thanks for you help and input!

TraderM

Use better file or folder example, when you close calgo another cbot can set position !?

        private void CloseBots(int i = 1)
        {

            // Mydocuments folder
            string path = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
            string dir = "\\CloseBot";
            path = path + dir;

            Print(path);
            // restet
            if (i == 1)
            {
                try
                {
                    System.IO.Directory.Delete(path, true);
                } catch (Exception e)
                {
                    Print(e);
                }
            }

            // set close folder
            if (i == 2)
            {
                try
                {
                    System.IO.Directory.CreateDirectory(path);
                } catch (Exception e)
                {
                    Print(e);
                }
            }

            // stop this cbot
            if (i == 3)
            {
                Stop();
            }
        }

 


@mindbreaker

mindbreaker
23 Nov 2015, 10:58

RE: RE: My solution
        private void CloseBots(int i = 1)
        {

            // Mydocuments folder
            string path = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
            string dir = "\\CloseBot";
            path = path + dir;

            Print(path);
            // restet
            if (i == 1)
            {
                try
                {
                    System.IO.Directory.Delete(path, true);
                } catch (Exception e)
                {
                    Print(e);
                }
            }

            // set close folder
            if (i == 2)
            {
                try
                {
                    System.IO.Directory.CreateDirectory(path);
                } catch (Exception e)
                {
                    Print(e);
                }
            }

            // stop this cbot
            if (i == 3)
            {
                if (System.IO.Directory.Exists(path))
                {
                    Stop();
                }
            }
        }

 


@mindbreaker

leo8three
25 Aug 2017, 23:54

Re: stop other robots from a single one

Hello everybody,

I'm the one more guy in search for a solution to this problem.

In addition to the already mentioned third party softwares, external file references etc., I was wondering if we can use the main server as a signal beacon.

Let's hypothesize we have our good MM Robot that wants to protect our equity level by closing all positions and stop other robots when things go wrong . What if it sends a bad volume order (suppose 0$) to deliberately made the main server to produce an error code? At this point we could use the OnError method to stop all your robots on the BadVolume error code. I will try to feature this trick very soon.

And here comes my suggestion to Spotware: why don't try to add a specific error code (HaltRequest would be a nice name) in a way that could use the server as a beacon for a signal generated from the client side?

What do you think about this idea? Is it feasible in your opinion?

Thanks for your attention.

 

Kind regards


@leo8three

... Deleted by UFO ...