@CBot instance [Sample RSI cBot, EURUSD, h1] process was unexpectedly terminated.

Created at 19 Jun 2023, 13:30
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!
D.

d.asteriti

Joined 19.12.2022

@CBot instance [Sample RSI cBot, EURUSD, h1] process was unexpectedly terminated.
19 Jun 2023, 13:30


Hello,

When I launch any cbot it returns me above error. How can I fix this?

Davide


@d.asteriti
Replies

PanagiotisChar
20 Jun 2023, 08:51

Hi there,

You need to share the cBot code and your cTrader's version to get further assistance.

Aieden Technologies

Need help? Join us on Telegram

 


@PanagiotisChar

d.asteriti
22 Jun 2023, 12:50

RE:

PanagiotisChar said:

Hi there,

You need to share the cBot code and your cTrader's version to get further assistance.

Aieden Technologies

Need help? Join us on Telegram

 

 

using cAlgo.API;
using cAlgo.API.Indicators;

namespace cAlgo
{
    [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class SampleRSIcBot : Robot
    {
        [Parameter("Quantity (Lots)", Group = "Volume", DefaultValue = 1, MinValue = 0.01, Step = 0.01)]
        public double Quantity { get; set; }

        [Parameter("Source", Group = "RSI")]
        public DataSeries Source { get; set; }

        [Parameter("Periods", Group = "RSI", DefaultValue = 14)]
        public int Periods { get; set; }

        private RelativeStrengthIndex rsi;

        protected override void OnStart()
        {
            rsi = Indicators.RelativeStrengthIndex(Source, Periods);
        }

        protected override void OnTick()
        {
            if (rsi.Result.LastValue < 30)
            {
                Close(TradeType.Sell);
                Open(TradeType.Buy);
            }
            else if (rsi.Result.LastValue > 70)
            {
                Close(TradeType.Buy);
                Open(TradeType.Sell);
            }
        }

        private void Close(TradeType tradeType)
        {
            foreach (var position in Positions.FindAll("SampleRSI", SymbolName, tradeType))
                ClosePosition(position);
        }

        private void Open(TradeType tradeType)
        {
            var position = Positions.Find("SampleRSI", SymbolName, tradeType);
            var volumeInUnits = Symbol.QuantityToVolumeInUnits(Quantity);

            if (position == null)
                ExecuteMarketOrder(tradeType, SymbolName, volumeInUnits, "SampleRSI");
        }
    }
}

 

cTrader Version 4.7.12.17878


@d.asteriti

PanagiotisChar
22 Jun 2023, 15:22

Hi there,

Are you running your cBot on any virtualization technology (VPS, Parallels etc)? Try giving full access to your code and see if it solves the problem

Aieden Technologies

Need help? Join us on Telegram


@PanagiotisChar

d.asteriti
22 Jun 2023, 16:21

RE:

PanagiotisChar said:

Hi there,

Are you running your cBot on any virtualization technology (VPS, Parallels etc)? Try giving full access to your code and see if it solves the problem

Aieden Technologies

Need help? Join us on Telegram

 

I'm not running my cBot on any virtualization technology. I'snt a good solution giving full access at cBots, Do you suggest another solution?


@d.asteriti

PanagiotisChar
23 Jun 2023, 08:37

No, I don't have any other suggestion at the moment. Maybe share your cBot's code and send some troubleshooting information


@PanagiotisChar