BACKTESTING AND OPTIMIZATION FAILURE IN VERSION 4.8.21

Created at 16 Aug 2023, 02:50
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!
TH

thebeinvest

Joined 15.04.2022

BACKTESTING AND OPTIMIZATION FAILURE IN VERSION 4.8.21
16 Aug 2023, 02:50


After updating to 4.8.21, backtesting has an error (crashed) in some operations, only in backtesting without activating visual mode.

If you perform backtesting with the visual mode activated, the problem does not occur.

This problem is only in this new version.

Optimization mode is also not possible as it gives the same error in optimization.

It is unfeasible to program, test and optimize in this new version.


cTrader Automate
@thebeinvest
Replies

PhoenixCapital
19 Aug 2023, 13:42

I am having a similar issue as well. The backtest just stops during a for loop after 50,000 entry. The new update is very buggy. I dont have an answer yet, but i will let you know when I do.


@PhoenixCapital

thebeinvest
21 Aug 2023, 08:51

RE: BACKTESTING AND OPTIMIZATION FAILURE IN VERSION 4.8.21

PhoenixCapital said: 

I am having a similar issue as well. The backtest just stops during a for loop after 50,000 entry. The new update is very buggy. I dont have an answer yet, but i will let you know when I do.

Thank you brother.

Indeed, after the last update these problems started.

I still haven't gotten a response either.

If you can, please let me know.


@thebeinvest

vinc.lomiglio
21 Aug 2023, 09:04 ( Updated at: 29 Feb 2024, 09:08 )

how can to close all position in the same of two symbols please i want close in the same if simbol1 take a profit i want that simbol2 close in the same

I

//ENTRATE_LONG
                    if ((FastResultL >0) 
                    {
                        var q = Symbol.QuantityToVolumeInUnits(quantity);

                        var q_2 = Symbol.QuantityToVolumeInUnits(quantity_2);
                     

                    tradeOperation = ExecuteMarketOrderAsync(TradeType.Buy, Symbol1, q, etichettaOperazioni_simbolo1 , StopLoss_Long, TakeProfit_Long);
                        
                     tradeOperation = ExecuteMarketOrderAsync(TradeType.Sell, Symbol2, q_2, etichettaOperazioni_simbolo2, StopLoss_Short, TakeProfit_Short);/
                        
                        Print("ORDINI long short INVIATI");
                        //Print("Positions Count:" + Positions.Count); 
                        //tradeOperation = ExecuteMarketOrderAsync(TradeType.Sell, Symbol2, q_2, etichettaOperazioni);
                        
                        tradeType = 1;
                        openedPositions++;
                        nOp++;
                        //Print("Position  LONG is opened");
                    }

 


@vinc.lomiglio

Spotware
22 Aug 2023, 05:03

Dear traders,

Can you please provide us with exact steps on how to reproduce this problem?

Best regards,

cTrader Team


@Spotware

ncel01
22 Aug 2023, 07:24

I've noticed huge differences in results when backtesting (visual vs non-visual modes).


@ncel01

thebeinvest
23 Aug 2023, 02:04

RE: BACKTESTING AND OPTIMIZATION FAILURE IN VERSION 4.8.21

Spotware said: 

Dear traders,

Can you please provide us with exact steps on how to reproduce this problem?

Best regards,

cTrader Team

                           double TrailingStopPips = (result * AjstSLM2);     
                                                  
                           var newStopLoss = pos.TradeType == TradeType.Buy ? Symbol.Bid - Symbol.PipSize * TrailingStopPips : Symbol.Ask + Symbol.PipSize * TrailingStopPips;              
                                         
                           var StopLoss = ModifyPosition(pos, newStopLoss, pos.TakeProfit, true);
                           
                           if (StopLoss.Error == ErrorCode.InvalidStopLossTakeProfit && (Account.Equity >= (Account.Balance * 1.01)) )                            ClosePosition(pos);


if I simply put "FALSE", deactivating the modify position, it doesn't give the error anymore, the error is in the position modification.


If I do a ModifyPosition and change StopLoss only once, the cbot doesn't crash, however, if I activate HasTrailingStop (true), then yes, it's crashing.

Again, in other versions this did not happen.

I've done the test by changing all trailingStop methods and all give the same error.

In summary, if I deactivate HasTrailing Stop (false) it works, if I activate it, it gives an error. And again... in the other versions, this didn't happen.

in backtesting, I activated the visual mode, and believe me, in visual mode I have no problem with backtesting, but without visual mode and also in optimization it has a problem, that is, I cannot perform optimization, nor backtesting without visual mode.

I have just tested it on ctrader version 4.7.13 and confirmed that backtesting works normally even without visual mode activated.

Thus confirming that version 4.8.21 brought this error bug.

Please... help me take this message to the developers, it will help a lot of people.

the algorithm is correct, however, with the new update it is giving this error.


@thebeinvest

Spotware
23 Aug 2023, 05:01

RE: RE: BACKTESTING AND OPTIMIZATION FAILURE IN VERSION 4.8.21

thebeinvest said: 

Spotware said: 

Dear traders,

Can you please provide us with exact steps on how to reproduce this problem?

Best regards,

cTrader Team

                           double TrailingStopPips = (result * AjstSLM2);                                                                                  var newStopLoss = pos.TradeType == TradeType.Buy ? Symbol.Bid - Symbol.PipSize * TrailingStopPips : Symbol.Ask + Symbol.PipSize * TrailingStopPips;                                                                                  var StopLoss = ModifyPosition(pos, newStopLoss, pos.TakeProfit, true);                                                      if (StopLoss.Error == ErrorCode.InvalidStopLossTakeProfit && (Account.Equity >= (Account.Balance * 1.01)) )                            ClosePosition(pos);


if I simply put "FALSE", deactivating the modify position, it doesn't give the error anymore, the error is in the position modification.


If I do a ModifyPosition and change StopLoss only once, the cbot doesn't crash, however, if I activate HasTrailingStop (true), then yes, it's crashing.

Again, in other versions this did not happen.

I've done the test by changing all trailingStop methods and all give the same error.

In summary, if I deactivate HasTrailing Stop (false) it works, if I activate it, it gives an error. And again... in the other versions, this didn't happen.

in backtesting, I activated the visual mode, and believe me, in visual mode I have no problem with backtesting, but without visual mode and also in optimization it has a problem, that is, I cannot perform optimization, nor backtesting without visual mode.

I have just tested it on ctrader version 4.7.13 and confirmed that backtesting works normally even without visual mode activated.

Thus confirming that version 4.8.21 brought this error bug.

Please... help me take this message to the developers, it will help a lot of people.

the algorithm is correct, however, with the new update it is giving this error.

Dear trader,

Can you please provide us with the complete cBot code so that we can reproduce the problem?

Best regards,

cTrader Team


@Spotware

dave.anderson.consulting
23 Aug 2023, 14:38 ( Updated at: 24 Aug 2023, 05:07 )

RE: RE: BACKTESTING AND OPTIMIZATION FAILURE IN VERSION 4.8.21

thebeinvest said: 

Spotware said: 

Dear traders,

Can you please provide us with exact steps on how to reproduce this problem?

Best regards,

cTrader Team

                           double TrailingStopPips = (result * AjstSLM2);                                                                                  var newStopLoss = pos.TradeType == TradeType.Buy ? Symbol.Bid - Symbol.PipSize * TrailingStopPips : Symbol.Ask + Symbol.PipSize * TrailingStopPips;                                                                                  var StopLoss = ModifyPosition(pos, newStopLoss, pos.TakeProfit, true);                                                      if (StopLoss.Error == ErrorCode.InvalidStopLossTakeProfit && (Account.Equity >= (Account.Balance * 1.01)) )                            ClosePosition(pos);


if I simply put "FALSE", deactivating the modify position, it doesn't give the error anymore, the error is in the position modification.


If I do a ModifyPosition and change StopLoss only once, the cbot doesn't crash, however, if I activate HasTrailingStop (true), then yes, it's crashing.

Again, in other versions this did not happen.

I've done the test by changing all trailingStop methods and all give the same error.

In summary, if I deactivate HasTrailing Stop (false) it works, if I activate it, it gives an error. And again... in the other versions, this didn't happen.

in backtesting, I activated the visual mode, and believe me, in visual mode I have no problem with backtesting, but without visual mode and also in optimization it has a problem, that is, I cannot perform optimization, nor backtesting without visual mode.

I have just tested it on ctrader version 4.7.13 and confirmed that backtesting works normally even without visual mode activated.

Thus confirming that version 4.8.21 brought this error bug.

Please... help me take this message to the developers, it will help a lot of people.

the algorithm is correct, however, with the new update it is giving this error.

Even without Trailing Stop it crashes on optimization. In one of my cBots I have no trailing stop and no ModifyPosition. Even that cBot crashes the same way.


@dave.anderson.consulting

thebeinvest
23 Aug 2023, 22:12

RE: RE: RE: BACKTESTING AND OPTIMIZATION FAILURE IN VERSION 4.8.21

Spotware said: 

thebeinvest said: 

Spotware said: 

Dear traders,

Can you please provide us with exact steps on how to reproduce this problem?

Best regards,

cTrader Team

                           double TrailingStopPips = (result * AjstSLM2);                                                                                  var newStopLoss = pos.TradeType == TradeType.Buy ? Symbol.Bid - Symbol.PipSize * TrailingStopPips : Symbol.Ask + Symbol.PipSize * TrailingStopPips;                                                                                  var StopLoss = ModifyPosition(pos, newStopLoss, pos.TakeProfit, true);                                                      if (StopLoss.Error == ErrorCode.InvalidStopLossTakeProfit && (Account.Equity >= (Account.Balance * 1.01)) )                            ClosePosition(pos);


if I simply put "FALSE", deactivating the modify position, it doesn't give the error anymore, the error is in the position modification.


If I do a ModifyPosition and change StopLoss only once, the cbot doesn't crash, however, if I activate HasTrailingStop (true), then yes, it's crashing.

Again, in other versions this did not happen.

I've done the test by changing all trailingStop methods and all give the same error.

In summary, if I deactivate HasTrailing Stop (false) it works, if I activate it, it gives an error. And again... in the other versions, this didn't happen.

in backtesting, I activated the visual mode, and believe me, in visual mode I have no problem with backtesting, but without visual mode and also in optimization it has a problem, that is, I cannot perform optimization, nor backtesting without visual mode.

I have just tested it on ctrader version 4.7.13 and confirmed that backtesting works normally even without visual mode activated.

Thus confirming that version 4.8.21 brought this error bug.

Please... help me take this message to the developers, it will help a lot of people.

the algorithm is correct, however, with the new update it is giving this error.

Dear trader,

Can you please provide us with the complete cBot code so that we can reproduce the problem?

Best regards,

cTrader Team

Hello!

No, unfortunately I can't share the full code.

But I think it's pretty clear here on the forum that a lot of people are having the same problem backtesting and optimizing with the new version.

And I made it clear where in my code it is generating an error, which is in TraillingStop, it is well explained in my answer above.

I believe that the programming team (Ctrader) must have a hundred example codes to simulate.

If several people are complaining about the same thing, and are having the same problem, it doesn't make sense to test only one code.

In fact, the version has problems, and they are impacting optimization adjustments, backtesting and negotiations.

I can a CopyTrader, and every month I redo the optimization of my Cbot, I see that next month not only me, but the people in my copy could be penalized for that.

And of course, I'll be informing everyone that the problem is in the new platform version and not in the Cbot itself, because I've already said it and I'll repeat it, it doesn't give an error in other Ctrader versions.

Thanks.


@thebeinvest

thebeinvest
24 Aug 2023, 08:27

RE: RE: RE: BACKTESTING AND OPTIMIZATION FAILURE IN VERSION 4.8.21

dave.anderson.consulting said: 

thebeinvest said: 

Spotware said: 

Dear traders,

Can you please provide us with exact steps on how to reproduce this problem?

Best regards,

cTrader Team

                           double TrailingStopPips = (result * AjstSLM2);                                                                                  var newStopLoss = pos.TradeType == TradeType.Buy ? Symbol.Bid - Symbol.PipSize * TrailingStopPips : Symbol.Ask + Symbol.PipSize * TrailingStopPips;                                                                                  var StopLoss = ModifyPosition(pos, newStopLoss, pos.TakeProfit, true);                                                      if (StopLoss.Error == ErrorCode.InvalidStopLossTakeProfit && (Account.Equity >= (Account.Balance * 1.01)) )                            ClosePosition(pos);


if I simply put "FALSE", deactivating the modify position, it doesn't give the error anymore, the error is in the position modification.


If I do a ModifyPosition and change StopLoss only once, the cbot doesn't crash, however, if I activate HasTrailingStop (true), then yes, it's crashing.

Again, in other versions this did not happen.

I've done the test by changing all trailingStop methods and all give the same error.

In summary, if I deactivate HasTrailing Stop (false) it works, if I activate it, it gives an error. And again... in the other versions, this didn't happen.

in backtesting, I activated the visual mode, and believe me, in visual mode I have no problem with backtesting, but without visual mode and also in optimization it has a problem, that is, I cannot perform optimization, nor backtesting without visual mode.

I have just tested it on ctrader version 4.7.13 and confirmed that backtesting works normally even without visual mode activated.

Thus confirming that version 4.8.21 brought this error bug.

Please... help me take this message to the developers, it will help a lot of people.

the algorithm is correct, however, with the new update it is giving this error.

Even without Trailing Stop it crashes on optimization. In one of my cBots I have no trailing stop and no ModifyPosition. Even that cBot crashes the same way.

Thanks for sharing buddy!

One more case and example that YES, there is a problem in this version.

Let's wait for the return of the team @Spotware

Thanks!


@thebeinvest