1. You have two choices;

1a. Calculate a score as part of your script (e.g. built in array 
PositionScore), use AddColumn to output the score, use SetSortColumns to sort 
by the score column. This will not be a continuous numbering (i.e. will not be 
1, 2, 3...). But, it will be the desired relative order. This is by far the 
easier way to go.

1b. Run two explorations. The way Explore works is that it processes each 
symbol, one at a time, ignorant of any symbols that have come before it and of 
any that might come after it. If Filter is true for the symbol being executed, 
a line of output is produced. Therefore, if you want a clean number sequence, 
you will have to run a first script to calculate scores and a second script to 
then match the symbol to the score and output a relative number.

2. The answer remains the same. The only difference is the means by which you 
calculate InPos. If you want to keep a separate data file of your open 
positions, you could use fopen/fgets/fclose to read and parse your actual 
positions for use with populating the InPos array. Daily maintenance would be 
to update the external file, the AFL would remain unchanged.

Mike

--- In [email protected], "gelsner99" <gels...@...> wrote:
>
> 
> 
> 
> 
> --- In [email protected], "Mike" <sfclimbers@> wrote:
> >
> > 1.  Manually; Just click on the column header to sort. Programatically;
> > Use SetSortColumns
> > http://www.amibroker.com/guide/afl/afl_view.php?id=314
> > 2.  You would need to capture the state of your positions then use that
> > as a condition for the color argument. Since AB adds the symbol by
> > default, you would have to disable the default and add it manually.
> > Buy = ...
> > Sell = ...
> > InPos = Flip(ExRem(Buy, Sell), ExRem(Sell, Buy));
> > 
> > Filter = Buy OR Sell OR InPos;
> > Colors = IIf(Buy, colorGreen, IIf(Sell, colorRed, colorYellow));
> > 
> > SetOption("NoDefaultColumns", True);
> > AddTextColumn(Name(), "Name", 1.2, colorDefault, Colors);
> > AddColumn(DateTime(), "Date", formatDateTime);
> > AddColumn(Close, "Close");
> > Mike
> > --- In [email protected], "gelsner99" <gelsner@> wrote:
> > >
> > > Hi,
> > >
> > > (1) With an Exploration what code would I need to add to display the
> > "Number" for the results?  (That is the highest ranked Ticker would be
> > number 1, etc.)
> > >
> > > (2) Also, with an Exploration, what code could I add that would color
> > the Full Name or Ticker if I am holding a particular Ticker?  (I realize
> > this would need to be changed as I change my holdings.)
> > >
> > > Thanks in advance,
> > >
> > > / GE
> > >
> >
> 
> Thanks for your ideas on these 2 questons:
> On question 1 -- I want to number the rows of the Exploration result 
> Programatically.  I don't find that SetSortColumns will do that job; is there 
> another approach?  
> 
> On question 2 -- This is a good idea; but in my case I want to select some of 
> the real holdings subjectively; so they may not be exactly the top 3 or 4 for 
> example.  I want to be able to change the code when my real holdings change; 
> and have the code Color in the Full Name or Ticker in a special Color 
> indicating this is a real holding.  Is there a way to do this?
> 
> Thanks in advance for your help on this, / GE
>


Reply via email to