Plot Change Backtest result

Hi, is there any reason to obtain different results on Backtesting just adding a Plot??
Sounds crazy, i know. But if i add two Plot sentences for drawing two Moving DEMAs, and Nothing More, the backtest changes! The AFl is very long for copy here but that´s the only change i do.

This isn't very apt, you should provide a code to reproduce whatever you see.

Anyway, having said that, it isn't good practice to dump all different context of code in one big file.
Many times people will have varied results due to type coercion also.
You can check recent threads for the effect of Param functions in Indicator vs Analysis etc
Of course, AB does its best to sort things, but until you provide code it isn't of much use..

The proper way is to enclose the appropriate code in the context that it applies to & not to assume everything

if( Status("ActionEx") == actionIndicator ) { . . . }
and the same for Explore, Backtest etc

Then check the same code that you are running.

1 Like

Hi Travick, thanks for your answer. You are right, but the code was more than 100 lines and with several #includes, so it was complicated to copy it here for looking for errors. Anyways i´ve checked the code and discovered that two of the #includes shared the name of a variable. For any reason this changes the result just plotting. Now the code is corrected and result are consistent.

1 Like

Well, that generally is the case :slight_smile:

Good that you posted back the reason for the error in the forum. :+1:

1 Like