Multiple cTrader’s Running Same cBots?

decanfrosty since: 18 Aug 2020;

  18 Nov 2022, 00:34
Multiple cTrader’s Running Same cBots?

GDPR-83_694920 said:

OK.... so I setup and have been using a NYC Server (Windows Server 2012 R2...! which I am typing this on now) for the last week or two and running a few bots live and whilst initially everything seemed ok I am now experiencing relatively frequent broker disconnects which seem to happen when I connect to the VPS (cTrader goes into a bit of a fit and the GUI gets messed up and is not showing properly the list of bots in automate and the broker connect is attempting then after 10-20 seconds things spring back into life) but other times I am only aware of it as I have not received any emails from the bots running that trigger trades every few hours or so on average and when I logon to the VPS I see the previous mentioned ‘fit’ and the broker connection eventually made then a handful of trades trigger that should have triggered some time ago! very frustrating :(

I am fed up with it so decided to write the following code in an attempt to catch the issue but every time the disconnect happens the bot (below) has stopped and no email is sent (email setup is 100% ok/the other bots running fire off emails no problems) so please advise what is wrong with the code or how I can achieve the desired results of sending emails every time a connect/disconnect happens

But also just to add Panagiotis with all due respect I think you and I both know that a single point of failure in any system is not ‘good enough’ and using a recommended VPS is still a single point of failure no matter which way you look at it - I have seen other posts going back 5+ years that are requesting greater fault tolerance and resilience of cTrader such as being able to autostart bots if a machine restarts unexpectedly/system crash - I totally appreciate this is no doubt complicated but I also do not believe this can be passed off by saying it has anything whatsoever to do with ‘no system can run 24/7 without any intervention’ - this is is not what we are talking about here and I really think Spotware need to start putting some effort into making their software (up for an award I think I saw - hope that goes well!) more resilient (for example why isn’t there already a built in tick box in the settings to send an email on server connect/disconnect?) and what about developing the ability I already spoke about where the same bot can run concurrently on different machines (multiple machines managing the same code/positions at the same time - I am  sure that would win Spotware many awards! :)

Thanks

MaxT

using System;
using cAlgo.API;

namespace cAlgo.Robots
{
    [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class ServerState : Robot
    {
        protected override void OnStart()
        {
            Server.Connected += OnServerConnected;
            Server.Disconnected += OnServerDisconnected;
        }

        protected  void OnServerConnected()
        {
            SendEmail("Connected "+Convert.ToString( Environment.MachineName),Convert.ToString(Server.TimeInUtc));
        }

        protected void OnServerDisconnected()
        {
            SendEmail("Disconnected " + Convert.ToString(Environment.MachineName), Convert.ToString(Server.TimeInUtc));
        }

        private void SendEmail(string subject, string body)
        {
            Notifications.SendEmail("abc@gmail.com", "xyz@outlook.com", Account.IsLive ? "[LIVE] " + subject : "[DEMO] "  + subject, body);
        }

        protected override void OnStop()
        {
            Server.Connected -= OnServerConnected;
            Server.Disconnected -= OnServerDisconnected;
        }
    }
}

Broker access to our accounts is now fully accessable in more ways than most know,to be manipulated for there own benifit.These things your speaking of Max are not workable in your favour and the commercial outlets advice is 100%Biased.I suggest revert back to a more semi manual management system and just except you need to do the work.All bots from my experience are lacking or you need to run multiple ea s to do the task .Waste of energy in the long run.Any advi e from the providers of indicators ,bots is worth nothing.Appears like there ,there to assist but in reality usless almost all of the time.Who in there right mind sells a product then says when it starts chewing ram....we also sell the chew less ram product and so on and so on.Slow and deliberately encumbered to mind.Double the required products to perform and double the profits....at your expense.Good luck my friend you know your stuff and trust in yourself.Avoid the snake oil salesman where you can.

decanfrosty since: 18 Aug 2020;

  18 Nov 2022, 00:34
RE: RE:You know what your doing MaxT

GDPR-83_694920 said:

OK.... so I setup and have been using a NYC Server (Windows Server 2012 R2...! which I am typing this on now) for the last week or two and running a few bots live and whilst initially everything seemed ok I am now experiencing relatively frequent broker disconnects which seem to happen when I connect to the VPS (cTrader goes into a bit of a fit and the GUI gets messed up and is not showing properly the list of bots in automate and the broker connect is attempting then after 10-20 seconds things spring back into life) but other times I am only aware of it as I have not received any emails from the bots running that trigger trades every few hours or so on average and when I logon to the VPS I see the previous mentioned ‘fit’ and the broker connection eventually made then a handful of trades trigger that should have triggered some time ago! very frustrating :(

I am fed up with it so decided to write the following code in an attempt to catch the issue but every time the disconnect happens the bot (below) has stopped and no email is sent (email setup is 100% ok/the other bots running fire off emails no problems) so please advise what is wrong with the code or how I can achieve the desired results of sending emails every time a connect/disconnect happens

But also just to add Panagiotis with all due respect I think you and I both know that a single point of failure in any system is not ‘good enough’ and using a recommended VPS is still a single point of failure no matter which way you look at it - I have seen other posts going back 5+ years that are requesting greater fault tolerance and resilience of cTrader such as being able to autostart bots if a machine restarts unexpectedly/system crash - I totally appreciate this is no doubt complicated but I also do not believe this can be passed off by saying it has anything whatsoever to do with ‘no system can run 24/7 without any intervention’ - this is is not what we are talking about here and I really think Spotware need to start putting some effort into making their software (up for an award I think I saw - hope that goes well!) more resilient (for example why isn’t there already a built in tick box in the settings to send an email on server connect/disconnect?) and what about developing the ability I already spoke about where the same bot can run concurrently on different machines (multiple machines managing the same code/positions at the same time - I am  sure that would win Spotware many awards! :)

Thanks

MaxT

using System;
using cAlgo.API;

namespace cAlgo.Robots
{
    [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class ServerState : Robot
    {
        protected override void OnStart()
        {
            Server.Connected += OnServerConnected;
            Server.Disconnected += OnServerDisconnected;
        }

        protected  void OnServerConnected()
        {
            SendEmail("Connected "+Convert.ToString( Environment.MachineName),Convert.ToString(Server.TimeInUtc));
        }

        protected void OnServerDisconnected()
        {
            SendEmail("Disconnected " + Convert.ToString(Environment.MachineName), Convert.ToString(Server.TimeInUtc));
        }

        private void SendEmail(string subject, string body)
        {
            Notifications.SendEmail("abc@gmail.com", "xyz@outlook.com", Account.IsLive ? "[LIVE] " + subject : "[DEMO] "  + subject, body);
        }

        protected override void OnStop()
        {
            Server.Connected -= OnServerConnected;
            Server.Disconnected -= OnServerDisconnected;
        }
    }
}

Broker access to our accounts is now fully accessable in more ways than most know,to be manipulated for there own benifit.These things your speaking of Max are not workable in your favour and the commercial outlets advice is 100%Biased.I suggest revert back to a more semi manual management system and just except you need to do the work.All bots from my experience are lacking or you need to run multiple ea s to do the task .Waste of energy in the long run.Any advi e from the providers of indicators ,bots is worth nothing.Appears like there ,there to assist but in reality usless almost all of the time.Who in there right mind sells a product then says when it starts chewing ram....we also sell the chew less ram product and so on and so on.Slow and deliberately encumbered to mind.Double the required products to perform and double the profits....at your expense.Good luck my friend you know your stuff and trust in yourself.Avoid the snake oil salesman where you can.

lagaaduu since: 23 Nov 2022;

  23 Nov 2022, 13:10

Thanks for the quick reply! yeh I am from an IT background/used to use Azure in the past (business use not trading) and compared to Beeks offering (shocking/dark ages) I felt Azure offered much more bang for the $ - obviously Micorosoft is quite a big company/a lot of hardware behind the scenes etc. 

Xammo since: 23 Jun 2021;

  25 Nov 2022, 02:19

Wow this is a blast from the past (my previous account on here/can't remember why I had to create a new one) over 2 years ago and here I am still in a similar situation (!) but take some solice in the fact that the disaster I just experienced with 4.5 has been damage limited due in part to the experiences of what I was going on about in this post! (no multiple cTraders operating on the same positions though/haven't become good enough programmer for that - went the other way and dumbed down the whole strategy even more than it already was instead!)

Interesting and mysterious comments @decanfrosty and I think I know who/what you're refering to and yes these are all factors I've taken into consideration along the journey but at the end of the day if you want to trade there has to be some way of interacting with the market -totally take your point on the more manual/semi automated approach and that's almost what i've ended up with (just can't manually fire off trades on multiple pairs at the same time even if it is one time a day)

I've thought many times about using the Spotware openAPI or whatever API it is where you can trade direct from code via API but quite honestly although I've done some python and knocked up a quick bot running on Binance's API I've yet to really try and work out Spotware's API and the documentation to me seems sparse and although I think there is like one example or something it's not enough for me to get the gist and something workable up and running - these things always seem very sparse around Spotware's 'help' info but once you get it you can see why they are sparse but would be helpful if they could flesh them out a bit to help the self taught programmers fumbling about in the dark!

Funny how this forum still has the problem of loosing what you've written too/taking you to the homepage! Am still always cutting and pasting before submitting but sometimes forget so annoying when that happens!

Cheers and best of luck to you too and beware the snake oil salesman/snake(s) in the grass! ;)