Thanks Graham,
This suggestion works perfectly.

Brian W


  ----- Original Message ----- 
  From: Graham 
  To: [email protected] 
  Sent: Monday, April 21, 2008 8:22 AM
  Subject: Re: [amibroker] Simple Exploration Question


  you could try this, and explore on n=1 last quotation

  inTrade = flip(buy,sell);

  filter = inTrade;

  addcolumn(valuewhen(buy,datetime()),"Buy Date",formatdatetime);


  -- 
  Cheers
  Graham Kav
  AFL Writing Service
  http://www.aflwriting.com 




  On 20/04/2008, Brian Wild <[EMAIL PROTECTED]> wrote:
    Thanks Graham for the response - but what you suggest is  what I first 
tried. The only difference is that I used the variable "bought" where you used 
"InTrade". In trying to sort this out I have come across a really puzzling 
result. I used AddColumn to show results for Buy, Sell, and bought. Then, 
changing only the filter value gives the following:-

    Case A. Setting Filter = Buy or Sell, gives output lines (correctly) only 
where there is a buy or sell signal.

    Case B. Setting Filter = 1 gives an output for every data point, with Buy 
and Sell still showing up as 1 correctly where they should, and bought showing 
correctly as 1 following each buy and remaining there until resetting to zero 
at the next sell. (so far so good!).

    Case C. Setting Filter = bought STILL gives output for every data point 
(incorrect!?). Buy and Sell still show 1 where they should, but bought  now 
shows as 1 throughout.

    I guess that with bought set to 1 throughout I should expect output for 
every data point - BUT how can this have happened in the circumstances. if 
anyone can explain I would be most grateful!

    Brian W

      ----- Original Message ----- 
      From: Graham 
      To: [email protected] 
      Sent: Sunday, April 20, 2008 2:49 PM
      Subject: Re: [amibroker] Simple Exploration Question


      you could try a few things, but this is probably the easiest

      inTrade = flip(buy,sell);

      filter = inTrade;

      -- 
      Cheers
      Graham Kav
      AFL Writing Service
      http://www.aflwriting.com

      On 20/04/2008, brianboofhead <[EMAIL PROTECTED]> wrote:
      > Hi,
      > Hope someone can help with this simple problem.
      > I have a system which generates Buy and Sell signals, and have used
      > Exrem to remove excess signals. I now want to run an exploration over
      > all symbols in my database to select all those for which the last
      > signal was a Buy. I realise I could use Explore over the last n days
      > (n=50 say)to pick up buy signals but would prefer to run over all
      > quotations and pick up the last Buy, regardless of how long ago that
      > was.
      > I tried adding:-
      > bought = flip(buy, sell); which sets bought to 1 after the last buy if
      > there is no subsequent sell.
      > Also used Addcolumn to display bought.
      > However, testing on a single stock with various attempts to filter on
      > the LastValue of bought didn't work, as the Explore output gave every
      > value in the chosen stock. My attempts to use ValueWhen(bi = Barcount)
      > fared no better.
      > The problem (to me at least) seems to be that when you would like to
      > set a single variable to a value, AFL makes it a complete array. The
      > reason for this long-winded question is that I think this problem of
      > getting single values rather than arrays arises all the time - so a
      > general explanation of ways around it would be most helpful.
      > Thanks in anticipation
      >
      > Brian W
      >
      >
      >
      > ------------------------------------
      >
      > Please note that this group is for discussion between users only.
      >
      > To get support from AmiBroker please send an e-mail directly to
      > SUPPORT {at} amibroker.com
      >
      > For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
      > http://www.amibroker.com/devlog/
      >
      > For other support material please check also:
      > http://www.amibroker.com/support.html
      > Yahoo! Groups Links
      >
      >
      >
      >







   

Reply via email to