Replies

mike.r.alderson
19 Dec 2023, 10:23 ( Updated at: 21 Dec 2023, 09:23 )

RE: RE: RE: Backtesting with Pending Orders - Amazing in Backtest, Devastating in Reality - is it my code?

firemyst said: 

mike.r.alderson said: 

PanagiotisCharalampous said: 

Hi Mike,

It is still hard to help you without exact steps on how to reproduce the issues on our machines. If you want the community to help you with coding issues, you need to help them reproduce the problem in two minutes :) Nobody will spend hours guessing what is wrong. We have our own problems to solve :)

Best regards,

Panagiotis

Ok, I'll try to be more exact:

I don't ‘think’ there's anything wrong with my code (although, happy to be corrected)- it seems to operate (in real-time), as expected.

My Question maybe should be: Does anyone else find that the Backtest doesn't seem to reflect anywhere near the Real-Time performance when testing a cBot that uses Pending Orders (i.e. Backtest performs amazingly, but in real-time shows poor results) and has anyone overcome this problem?  

(Perhaps, a setting I need to change or an add-on I need to download, a certain library I should be using?)

So as @PanagiotisChar hinted in a previous post, how are you doing your back tests? What settings in the back testing mechanism do you use? Do you have any screen captures to show your back test results with your settings?

Like, you're not providing us with any details on how you are backtesting, what the parameter settings are, etc etc.

 

Ok, thanks for the feedback, this is my first community post and I'm not really aware of other ways to perform a backtest other than: I copied the code from above, pasted it into a New Algo on cTrader, Compiled using .NET6 - added the Nas100 (1m) as an instance, as above, the parameters are default - then I ran the backtest from 12/6/2023 - 12/12/2023, as above and it looked a lot like this:

 

It seems awesome, right?  But in reality, the algorithm does not make money.  My question is: Is there a way to ensure that Algorithms in Backtest perform even close to how they do in the live markets?  Or does the cTrader backtest simply not work properly when using Pending Orders?

 

Here's an Example of one of the errors:

Trade 7:  Closed at a Profit of 13.1 pips (History), even though the TakeProfit was set to 3 pips and when looking in Events, it looks like it actually Stopped Out:

I would imagine, using the same code as above, with the default parameters, backtesting in the NAS100 (1m) on the same dates would provide the same result on a different computer.

 

Happy to provide more information, if you could let me know what might be helpful?

 

Kind regards

 

Mike

 


@mike.r.alderson

mike.r.alderson
14 Dec 2023, 15:21

RE: Backtesting with Pending Orders - Amazing in Backtest, Devastating in Reality - is it my code?

PanagiotisCharalampous said: 

Hi Mike,

It is still hard to help you without exact steps on how to reproduce the issues on our machines. If you want the community to help you with coding issues, you need to help them reproduce the problem in two minutes :) Nobody will spend hours guessing what is wrong. We have our own problems to solve :)

Best regards,

Panagiotis

Ok, I'll try to be more exact:

I don't ‘think’ there's anything wrong with my code (although, happy to be corrected)- it seems to operate (in real-time), as expected.

My Question maybe should be: Does anyone else find that the Backtest doesn't seem to reflect anywhere near the Real-Time performance when testing a cBot that uses Pending Orders (i.e. Backtest performs amazingly, but in real-time shows poor results) and has anyone overcome this problem?  

(Perhaps, a setting I need to change or an add-on I need to download, a certain library I should be using?)


@mike.r.alderson

mike.r.alderson
14 Dec 2023, 09:07 ( Updated at: 14 Dec 2023, 09:09 )

RE: Backtesting with Pending Orders - Amazing in Backtest, Devastating in Reality - is it my code?

PanagiotisCharalampous said: 

Hi there,

You should explain your issue with more details. You should provide at least some examples of what the problem is.

Best regards,

Panagiotis

Thank you for such a Quick Response.  Ok, so first we have the backtest results, testing this on the Nas100 (Pepperstone) 12 June 2023 - 12 Dec 2023, it shows an increase of 1,782% - (Yeay! Early Retirement) - but then I notice that a LOT of the trades are doubled up, which shouldn't be possible given the code setup (in my limited experience) and many of the trades close past their StopLoss and TakeProfit by substantial amounts.  Here's a summary:

  1. Results are Unrealistic
  2. Trades double up - (Trades 5 and 6, for example.)
  3. Trades close beyond the TakeProfit by a substantial amount: (Trades 7, 9, 23, etc.)
  4. Trades close beyond the StopLoss by a substantial amount: (Trades 107, 183, etc.)

I'm currently trialling this cBot in a Demo account for a real-life comparison.

(Edit: FYI, Huge Fan of the Software and Support (so much easier than learning MQL5) - this has been a game-changer for me, personally, and I recommend cTrader/Pepperstone to everyone interested)

Many thanks

Mike


@mike.r.alderson