bot crashes in backtest

Created at 17 Feb 2025, 21:49
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!
KY

kyosuke

Joined 17.03.2022

bot crashes in backtest
17 Feb 2025, 21:49


hi, I'm backtesting a bot which crashes only in non visual mode…when it crashes it says “crashed with error #F25CBF78”…so:

  • where can i find a list of ctrader error codes with relative description?
  • why it only crashes in non visual mode while it goes through the end in visual mode?

@kyosuke
Replies

firemyst
18 Feb 2025, 05:08

  • There isn't one unless Spotware has a secret list
  • you're probably doing something that the code, whether you know it or not, expects to have access to something on the chart, which it obviously doesn't since it's in non-visual mode.

@firemyst

kyosuke
18 Feb 2025, 08:37

RE: bot crashes in backtest

firemyst said: 

  • There isn't one unless Spotware has a secret list
  • you're probably doing something that the code, whether you know it or not, expects to have access to something on the chart, which it obviously doesn't since it's in non-visual mode.
  • oh…and how do they expect developers to fix their code?
  • actually no, i'm only reading an indicator, placing stop orders, moving SLs and TPs

the only other thing i noticed is that right before the crash i have an “Modifying position PID30 (SL: 1.07551, TP: 1.083) FAILED with error "InvalidStopLossTakeProfit"” error…but i have this error also a few other times a lot of time before the crash so I don't think that's the point


@kyosuke

firemyst
18 Feb 2025, 23:52

RE: RE: bot crashes in backtest

kyosuke said: 

firemyst said: 

  • There isn't one unless Spotware has a secret list
  • you're probably doing something that the code, whether you know it or not, expects to have access to something on the chart, which it obviously doesn't since it's in non-visual mode.
  • oh…and how do they expect developers to fix their code?
  • actually no, i'm only reading an indicator, placing stop orders, moving SLs and TPs

the only other thing i noticed is that right before the crash i have an “Modifying position PID30 (SL: 1.07551, TP: 1.083) FAILED with error "InvalidStopLossTakeProfit"” error…but i have this error also a few other times a lot of time before the crash so I don't think that's the point

 

If you don't post any sample code that reproduces the problem, I don't know how you expect people to be able to help you further.

 


@firemyst

kyosuke
19 Feb 2025, 09:37

RE: RE: RE: bot crashes in backtest

firemyst said: 

kyosuke said: 

firemyst said: 

  • There isn't one unless Spotware has a secret list
  • you're probably doing something that the code, whether you know it or not, expects to have access to something on the chart, which it obviously doesn't since it's in non-visual mode.
  • oh…and how do they expect developers to fix their code?
  • actually no, i'm only reading an indicator, placing stop orders, moving SLs and TPs

the only other thing i noticed is that right before the crash i have an “Modifying position PID30 (SL: 1.07551, TP: 1.083) FAILED with error "InvalidStopLossTakeProfit"” error…but i have this error also a few other times a lot of time before the crash so I don't think that's the point

 

If you don't post any sample code that reproduces the problem, I don't know how you expect people to be able to help you further.

 

I expect getting help in translating that error code into a textual understandable error description, not for sure putting the source code of a program on a public forum…I don't think my concerns are strange, are they? :)


@kyosuke

firemyst
19 Feb 2025, 10:07

RE: RE: RE: RE: bot crashes in backtest

kyosuke said: 

 

I expect getting help in translating that error code into a textual understandable error description, not for sure putting the source code of a program on a public forum…I don't think my concerns are strange, are they? :)

 

Well I wouldn't expect much help then, bceause you need to give a bit more for even Spotware to have something to investigate. 

And not asking for whole code - just sample code that reproduces the issue.


@firemyst

kyosuke
19 Feb 2025, 10:55

RE: RE: RE: RE: RE: bot crashes in backtest

firemyst said: 

kyosuke said: 

 

I expect getting help in translating that error code into a textual understandable error description, not for sure putting the source code of a program on a public forum…I don't think my concerns are strange, are they? :)

 

Well I wouldn't expect much help then, bceause you need to give a bit more for even Spotware to have something to investigate. 

And not asking for whole code - just sample code that reproduces the issue.

yep…I get the point…unfortunately as i said before the problem seems to came out right after modifying a stop loss with an invalid price…so the piece of code is “simply” this, nothing strange:

foreach (var pos in Positions.FindAll(_Label, SymbolName)) {
	if (
		(pos.TradeType == TradeType.Buy && pos.EntryPrice < Symbol.Bid)
		|| (pos.TradeType == TradeType.Sell && pos.EntryPrice > Symbol.Ask)
	) {
		pos.ModifyStopLossPrice(pos.EntryPrice);
	}
}

it basically puts a BE stop loss. the strange part is that in the logs i can find more than 1 error referring to an invalid stop loss price but it only crashes at some point, not punctually at every occurence of the error. looks like it tolerate a variable amount of errors and then it gives up crashing.

let me know if the informations given can help you more…


@kyosuke