[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [amibroker] Simple Exploration Question



PureBytes Links

Trading Reference Links

Hi - If I understand you correctly, you could try something like this over all bars. Untested...
 
CumBuys = cum( Buy );
TotalBuys = LastValue( CumBuys );
LastBuy = CumBuys == TotalBuys AND ref( CumBuys, -1 ) != TotalBuys;
LastBuyDate = ValueWhen( LastBuy, DateNum() );
 
CumSells = cum( Sell );
TotalSells = LastValue( CumSells );
LastSell = CumSells == TotalSells AND ref( CumSells, -1 ) != TotalSells;
LastSellDate = ValueWhen( LastSell, DateNum() );
 
StillLong = LastBuyDate > LastSellDate;
Filter = LastBuy AND StillLong;
AddColumn( LastBuyDate, "Last Buy Date", 1.0 );
 
Steve
----- Original Message -----
From: Brian Wild
Sent: Sunday, April 20, 2008 3:26 AM
Subject: Re: [amibroker] Simple Exploration Question

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
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 <wild21@xxxxxxxxxcom.au> 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
>
>
>
>

__._,_.___

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




Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___