cBot crashed: Error #16302763

Created at 25 Apr 2020, 22:18
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!
CO

contact.bitq

Joined 11.04.2020

cBot crashed: Error #16302763
25 Apr 2020, 22:18


Hi,

I got this error when I try to get Symbol object from symbol name.

I'm developing a bot that handles multiple symbols at the same time.

Paste this code into your cBot onTick function

 

Reproduction step:

1. Requirement: backtesting data for symbol CADJPY was not cached, it means you backtest this  CADJPY for the first time

2. Add cBot instance "EURUSD, h1" (must not be CADJPY)

3. Insert reproduction code bellow to your Robot:

// This function was triggered every new signal comes from socket message.
    private void OnNewSignalFromSocketMessage(MySignal signal)
    {
      string unverifiedSymbol = "CADJPY";
      Symbol botSymbol = null;
      if (Symbols.Exists(unverifiedSymbol))
      {
        botSymbol = Symbols.GetSymbol(unverifiedSymbol);
      }
      else
      {
        throw new Exception("GetSymbol: Symbol not supported: " + unverifiedSymbol);
      }

      // Re check once more
      if (botSymbol == null)
      {
        throw new Exception("CheckNull: Symbol not supported: " + unverifiedSymbol);
      }
    }

4. In backtesting tab (beside optimization tab), start backtesting

 

 

 

---------

These errors only happen on newSocketMessage handler, If I put the code into OnTick() function, it works fine.

Is there any threading issue here?

I often (not always) get some randomly error bellow (it not always appears):

 

ERROR1: System.InvalidOperationException

18/03/2020 07:06:10.000 | telegram.sendMessage
18/03/2020 07:05:20.000 | onCreateOrderFailed: System.InvalidOperationException: Operation is not valid due to the current state of the object.    at cTrader.Automate.Small.V1.Dispatchers.WaitingStrategy.BeginWait[TMessage](Func`2 predicate)    at cTrader.Automate.Small.V1.MessageDispatcher.BeginWait[TMessage](Func`2 predicate)    at cTrader.Automate.Small.V1.MessageDispatcher.SendMessageWithResponse[TRequestMessage,TResponseMessage](TRequestMessage requestMessage, Func`2 predicate)    at cTrader.Automate.Small.V1.Backtesting.SymbolsApi.SmallBacktestingSymbolSubscriptionController.Subscribe(ISmallSymbol[] symbols)    at cTrader.Automate.Small.V1.SymbolsApi.SmallSymbols.GetSymbolsWithSubscriptionInternal(String[] symbolNames)    at cTrader.Automate.Small.V1.SymbolsApi.SmallSymbols.GetSymbol(String symbolName)    at cAlgoBitQ.Service.Order.createOrderFromSignal(Robot cBot, FxSignal s) in c:\Users\Neo\Documents\cAlgo\Sources\Robots\BitQ Signal Executor\BitQ Signal Executor\Order.cs:line 31    at cAlgo.Robots.BitQSignalExecutor.onNewFxChanneMessage(String message) in c:\Users\Neo\Documents\cAlgo\Sources\Robots\BitQ Signal Executor\BitQ Signal Executor\BitQ Signal Executor.cs:line 149
18/03/2020 07:05:00.000 | onNewFxChanneMessage: signals.Count 2
18/03/2020 07:00:30.000 | initRemoteSignal: OnConnected
18/03/2020 07:00:00.000 | Backtesting started

ERROR2: 

Exception of type 'cTrader.Automate.Small.V1.Exceptions.AlgoAbortedException' was thrown.

===> I wanna know more detail, but no more detail about this error that I could find!

 

ERROR 3:

CheckNull: Symbol not supported: EURCAD

===> No exception was thrown in Symbols.GetSymbol right?

 

 


@contact.bitq
Replies

contact.bitq
26 Apr 2020, 10:04

Those issues only occur on Visual Backtesting mode.

 


@contact.bitq

PanagiotisCharalampous
27 Apr 2020, 09:38

Hi contact.bitq,

Can you please provide the complete cBot code?

Best Regards,

Panagiotis 

Join us on Telegram


@PanagiotisCharalampous