Exploration of same AFL with different parameters in different time-frames

Hello friends

I have one AFL for which I wish to run exploration continuously on three time-frames 5, 10 and 15 min respectively. I am able to get all three explorations running but I am unable to compartmentalize the three analysis windows. I am unable to set different parameter for each analysis window.

Following are the steps and attempts that I have performed before posting this query here.

ATTEMPT ONE of TWO
Step 1) I created three analysis windows and set the name of the desired AFL in Formula field correctly. No problems here. When I tile all analysis windows horizontally, I see name of my AFL displayed three times correctly.
Step 2) I set Back-tester Settings->Periodicity to 5, 10 and 15 min respectively. No problems here either. After setting, if I re-open each back-tester setting, I can see my settings appear correctly.
Step 3) Next, I attempt to set AFL parameters. I first changed values as I wanted on first analysis meant to run on 5 mins. When I moved to the next analysis (10 mins) I could see values that I set for 5 min instead of the default ones from Param() function. I changed parameters again for 10 min Analysis. Same observation repeated for 15 min analysis window. Whichever parameter window I change last seems to override the other two.

Assuming that Amibroker was saving parameters settings using the AFL name, I tried one more trick, I made three copies of my original AFL and named them as One.AFL, Two.AFL and Three.AFL respectively and attempted again.

ATTEMPT TWO of TWO

Step 1) I created three analysis windows and set the name of the desired AFLs (One.AFL, Two.AFL and Three.AFL) in each of the formula fields correctly. Again, no problems here. When I tile all analysis windows horizontally, I see all different AFL names displayed correctly.
Step 2) I set Backtester Settings->Periodicity to 5, 10 and 15 min respectively. Again, mo problems here either. After setting, as I re-open backtester setting, I am able to see periodicity being set correctly.
Step 3) Next, I attempt to set AFL parameters. I first set changed values as I wanted on One.AFL. When I moved to the next analysis with Two.AFL, I could see values that were set in One.AFL instead of default ones from Param function. Again, I changed params for Two.AFL. Same observation was repeated for Three.AFL. Whichever parameter window, I change last seems to override the other two.

Your problems come from using Param() functions in Analysis. This issue has been discussed many times on the forum. For instance in this thread:

I quote @fxshrat from that thread:

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.)
3 Likes

Summing up, if you want to avoid such problems when doing Scan, Exploration, Backtest or Optimization (especially when using multiple Analysis windows at the same time) use hardcoded values instead of Param() functions.

1 Like

Thank you very much for clearing this up. Milosz.

I will hard-code param values in all three afls and move on ....

1 Like