Changing Param in Backtest


I can see how to change parameters (param) in a chart, and also in the "old" backtester, but I cannot see how to change them in the current backtester. Is the only way to use optimize? I don't want to optimize, just change parameters manually between each backtest.




You should not use Param functions in analysis and especially should not use it for backtesting.

Originally Param functions were made for charts only.

In analysis char tID is always zero (and for all analysis windows). So it leads to problems if you do not take care.

Instead for backtesting (and analysis in general) best solution is to use hardcoded values.


So, really no way to use Param and Optimize inputs at the same time it looks like? Has to be one or the other?

This is not very user friendly. Doesn't it make sense to have Parameters and Optimize be in the same spot, where you can toggle between each in the UI without having to go to code?

I am a programmer and it makes me no difference, but my clients are not and they are complaining.....


@fxshrat prefers not to use Param statements in Analysis, but that's his personal preference, not a limitation of AmiBroker. I use Param* functions for my clients all the time, for exactly the reason you stated. You can simply use a construct like this:

myValueDefault = Param("My Value", 3, 1, 5, 1);
myValue = Optimize("My Value",  myValueDefault, 1, 5, 1);



It's got nothing to do with personal preferences! This wrong statement alone shows that you do not fully understand how param functions operate at all.

It has got to do with feature design and pitfalls. And params were designed for charts. Historical fact since mentioned by designer himself.

Have you actually understood what has been written? Obviously not.

Param functions are dependent on ChartID and in analysis ChartID is always zero for all analysis windows. Since all analysis have ChartID value zero it may lead to problems (even more so for beginners or technology illiterates) as parameters are shared. If you change param in one window it will effect param of any other analysis window. So they influence each other.

Summary about the main pitfalls of Param.. functions in analysis window (for which they were not designed for):

  • If params of Param.. functions have same parameter name then changing one param in one analysis window will set param with same parameter name of any other analysis window to same set value
  • If params of Param... functions have different parameter name then changing one param in one analysis window will reset any param of any other analysis window back to default value.
  • Set params of Param... functions are not saved to project files.
  • (And of course params are reset to default value if closing and reopen an analysis window. Well, that one is expected.)

Yeah, ... simply... not understood a single thing of what has been said. (And BTW, you can simply do anything simple but the question is about negative effects being forgotten and put aside).

Clients wasting money on incompetent vendors (still being amateurs themselves) who don't even tell those poor clients about possible consequences that may occur in return (and wasted time in the end because of wrong applied features). Don't waste money on people who do not fully understand AmiBroker functionalities, implementations and proper programming.

And FYI, Tomasz himself has told about param functions design several times in the past.

  1. Tomasz quote:

Currently the best solution is using Parameters for CHARTS ONLY,
and NOT using them for Analysis. Parameters in fact were designed as chart-only tool to begin with,
and quite frankly adding them to Analysis window was a mistake.

  1. Tomasz quote (still about params in analysis)

BTW, if you want to use params for analysis via saver way then read here


@fxshrat: Thanks for your insights on this topic. Now that @vjsworld has plenty of input on the pros and cons of various approaches, I'm confident that he can choose the method that's most appropriate for his own development.


@vjsworld perhaps there is a role here for your clients to use a function that combines Param and Optimize,

function ParamOptimize( pname, defaultval, minv, maxv, step )
	return Optimize( pname, 
	Param( pname, defaultval, minv, maxv, step ),
	minv, maxv, step );

From @Tomasz (scroll to bottom)

I am not sure how this fits in with all of the information that @fxshrat has just posted.



You ask how that fits in with upper information?

Since you still don't seem to understand (how about testing yourself?)... It suffers from same effects in analysis windows. It does not matter where you place params in your code. I mean why are you guys not able to test upper mentioned main pitfalls yourself?

Once again all Params between more than one analysis windows interfere with each other because all analysis windows have same chart id (0). Params were designed for charts originally. It is that simple.

Just keep following in mind:
Param functions are dependent on chartid. And analysis is not equal to chart.

Now... as for your link and Tomasz's function posted in comments section... Have you looked at the year it was posted? 2006! Right? Now it is year 2018 and we have AB of 2/3 bigger size.

Do you know about the state of AmiBroker back then in 2006? No? I tell you. Back then AmiBroker still had just one single analysis window(So one single chartid value=zero occurrence instead of multiple ones now) and no analysis projects feature.

And the quotes of Tomasz I was posting above are from many years later (2012) after AmiBroker already had implemented multithreaded new analysis with ability to open multi analysis windows side by side. Big difference to 2006. Right? (New analysis was introduced in 2011/2012, BTW.)

AmiBroker evolves and does not stand still. You have to know the history, features purposes and must be aware of pitfalls of this and that instead of just talking about "simply do this and that...".

BTW I am finding quite it hilarious that there are "vendors" here asking others on how to solve code issues (to do his/her job?).



Your posts are very educational, and much appreciated. I am on my third week of learning Amibroker. I have programmed on Tradestation, Trading Technologies, Bloomberg, and Reuters for the past twenty years. Yes, without the history that you have, there is no way to know these things. So I am reading as much as possible, asking questions, and mad experimenting. I am just trying my best to learn this new platform as fast as possible. I am not a vendor. I do not sell systems. I have a client that wants me to learn this platform, so here I am.

Once again, thank you to all who has helped me.