Explorer with Options

Good morning and thanks in advance,

I'm trying to create an Explorer where I can select the columns I want to view based on two options. This is the AFL:

///// EXPLORADOR /////
Filter = Status("lastbarinrange");

CurrentorPastOption = ParamToggle("CurrentorPastOption", "Current|Past", 0);

if(CurrentorPastOption == 0)
{
	AddColumn( ROCYTD, "ROCCurrentYear", 1.2);
	AddColumn( ROCTrimestreenCurso, "ROCCurrentQuarter", 1.2);
	AddColumn( ROCMesenCurso, "ROCCurrentMonth", 1.2);
	AddColumn( ROCSemanaenCurso, "ROCCurrentWeek", 1.2);
	AddColumn( ROCAyer, "ROCDaily", 1.2);
}
else
{
	AddColumn( ROCAnoPasado, "ROCLastYear", 1.2);
	AddColumn( ROCTrimestrePasado, "ROCLastQuarter", 1.2);
	AddColumn( ROCMesPasado, "ROCLastMonth", 1.2);
	AddColumn( ROCSemanaPasada, "ROCLastWeek", 1.2);
}

I have also tried with ParamList function but its the same result.

If I change the option in Parameters, nothing happens. I have to press Explore again to change the columns.

Is it possible to make it so that when I change the Parameters, the columns change automatically without having to run Explore again? I'm not sure if I explained myself correctly.

Thank you very much.

In your case, especially when you have different variables in AddColumn() for IF-Else, you have to click explore again because that forces the AFL to be executed to get new results.

If you want to compare, you can export results > right click > select all > copy
paste in spreadsheet like MS Excel etc

OR File > export html/csv ( again use windows tile for apps side-by-side )

OR You can open 2 analysis windows side by side also, with same AFL. Use AB > window > tile vertically
( *but note, you cannot open the same apx twice, you could use 2 different files )

Thanks for your response, nsm51.

So I understand there's no way to choose which variables to display simply by selecting an option from Parameters?

Short answer is no.

An active chart appears to be continuously running , so there is no run button and that is why parameters seen to automatically update.

Analysis window is triggered by scan, explore, optimize, backtest buttons etc or by periodic auto-run from settings.

If you want more complexity, clicking the analysis parameter button does run the AFL but it does not update the output.
You can check by making an error in AFL and click parameter button (you will see error message box)

or status("actionExAAParameters")

Thanks for your time nsm51

Obviously, you need to actually EXECUTE the code to have any effect.
How could anyone think it would happen without execution, I don't know. It is like expecting car to go anywhere without turning on the engine.

Having said that Analysis can be re-run periodically Net effect would be that any changes to parameters would be reflected automatically (in next rerun). It is just a matter of using built-in auto-repeat option, that is obviously described (like everything else) in the Users' Manual:

http://www.amibroker.com/guide/h_newanalysis.html

Auto-repeat interval can be entered in the Interval field. Note that plain numbers (like 5) represent minutes. To get seconds you need to enter 5sec or 5s and press ENTER

It is worth reading the manual. If you don't want to read it at least upload the manual to ChatGPT and ask AI, it is way better than making assumptions on how things work or don't work.

Finally, it makes very little sense to use the code as presented in this thread anyway. It is way better just to OPEN TWO ANALYSIS WINDOWS (File->New->Analysis) at once and run TWO different formulas. You will get BOTH results at once easily switchable using TAB.

I wonder why most obvious and best solutions are never used.

2 Likes

but i suggested both alternatives :thinking:

I was not answering to your answer, but to original poster question.

1 Like