How to quickly add flags that show up in exploration

Basically, I'm running an exploration to autoscan every minute. It shows up with around 8-12 results. I manually check those stocks to see if it matches my criterion. What I want to do is set a flag after doing the manual check, so that the flag shows up in the exploration. This will allow me to check only the stocks that I haven't checked within the last few minutes. Is there a quick way to do this?

One easy way to get this done can be with the GUI Toggle Button functionality.
Since you have specified Quickly

  1. Create a GUI Toggle Button
    http://www.amibroker.com/guide/afl/guitoggle.html

This bit of code will be added to your chart AFL

  1. The Event Handler will also be in the Chart AFL.
    Handling the event can be found here
    http://www.amibroker.com/guide/h_gui.html
    You can almost copy-paste it.

  2. The guide also mentions about using Static Variable to save state.

  3. So now you enhance that a bit by creating Static Variable + Name(), so each symbol has its own static Variable.

  4. In the AFL that runs in Exploration, each time, read the static variable corresponding to that symbol

  5. If toggle is on, use a separate column a an identifier
    OR using a different background color etc for the row to know that you already visited it.

  6. Last but not least, you can add a small code, say after a certain period, like 1Hr, you can reset all Staiv Variables so that the Flags are all removed.

3 Likes

This will suit me quite well. Any solution that doesn't require version 6.30??

Use GFX to make the button
There are many ready to use code examples

See Milosz's post

If you don't want to draw GFX and CTRL+mouse click alone can also do

2 Likes

@TheNutz alternatively you can fully automate the whole process. For example if you add this or similar code to one of your charts:

StaticVarSet("LastVisit" + Name(), Now(5));

And something like this to the exploration's code:

LastVisit = Nz( StaticVarGet( "LastVisit" + Name() ) );
Difference = DateTimeDiff( Now( 5 ), LastVisit );

if (Difference >= 300) TextColor = colorRed;
else TextColor = colorDefault;

You will be able to output the time (in seconds) that has left since the last time a specific symbol was displayed on your chart or (as in this example) choose a text/background color depending on the time difference ...

Or if you want to set the flags manually, alternatively to GuiButtons or Gfx functions, you can also use ParamTrigger or ParamToggle. Besides as @travick noted, Ctrl + Mouse click also will do. There are countless possibilities...

6 Likes

Thank you, both. The code of @Milosz, both in the linked post and in the above post, helped tremendously.

1 Like