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

Re: [amibroker] counting setups and conditioning the buy on that count



PureBytes Links

Trading Reference Links

Yuki,

Graham is on the right track ... I think I interpret your objective a little
differently...

I understand that you want to see how many stocks give you a setup on any
given day. If you have a greater number of setups then a predetemined value,
then you trade.

Looks like you need to do 2 passes.
1. First pass to count the number of setups and store them in an ATC file,
instead of trading.
2. Modify your code so it reads the ATC file you just wrote and then process
your normal trade conditions.

You can accomplish this by either modifying a couple of lines of code to
change the operation or use a parameter to do the switching.

TestMode = Param("TestMode",1,1,2,1);  //TestMode 1 writes the ATCs

if  (TestMode==2)
{
Setups = Foreign(~ATC ... )  // read ATC file to determine if you should
trade
}


Test code
....
...

if  (TestMode==1)
{
Setups = AddToComposite(...
}
else
{
Buy = ... your "normal" criteria and TestMode == 2 and Setups >= you
criteria for setups
Sell = ...
}


It's an interesting concept.

Ara

----- Original Message ----- 
From: "Yuki Taga" <yukitaga@xxxxxxxxxxxxx>
To: "Graham" <amibroker@xxxxxxxxxxxxxxx>
Sent: Sunday, January 29, 2006 10:10 PM
Subject: Re: [amibroker] counting setups and conditioning the buy on that
count


> Hi Graham,
>
> I'm not sure whether you misunderstood me or not Graham.  But I
> didn't understand what you wrote, either.  ^^_^^
>
> What I want to do is compare my plain vanilla backtest, which would
> take every signal in the trading basket every time there is a signal,
> with a backtest in which *no* signals are taken unless there is a
> certain number of setups.
>
> For example ...
>
> Let's say I can have anywhere from 0 to 50 setups on any given day.
> Some of these will signal the next day, and some won't.  I can easily
> run a backtest that tells me how well or poorly that system performs.
>
> But, now I want to try a type of optimization.  What I want to do is
> prohibit all buys unless setups = x, and then see what the results
> would be.  In other words, I can have 0 to 50 setups, but let's say
> only 2 symbols setup on any given day.  I now want to test only
> signals taken when there were only 2 setups, versus signals taken
> when there were more setups.
>
> What I'm trying to do is discern whether or not this particular
> system would work better, worse, or the same, if I restricted it
> based on not taking trades at all when only a few symbols setup on a
> given day.
>
> Now you know why I can't write the algorithm.  I can't even explain
> it very well in English.  ^_-
>
> Yuki
>
> Monday, January 30, 2006, 1:17:20 PM, you wrote:
>
> G> Yuki
> G> Did I misunderstand your query?
> G> I took your mention of symbols as you wanting to count signals for all
> G> the symbols on your watchlist for that AFL.
>
>
> G> --
> G> Cheers
> G> Graham
> G> AB-Write >< Professional AFL Writing Service
> G> Yes, I write AFL code to your requirements
> G> http://e-wire.net.au/~eb_kavan/ab_write.htm
>
>
> G> On 1/30/06, Yuki Taga <yukitaga@xxxxxxxxxxxxx> wrote:
> >> Hi Rakesh,
> >>
> >> I think, maybe, you best understand exactly what I am trying to do. I
> >> apologize for not being clear enough if others misunderstood me.
> >> Happens all the time. ^_-
> >>
> >> Basically, I have a two-step operation now.  1) run an EOD
> >> exploration with a filter statement that selects setups.  2) buy
> >> those setups the next day if they pass the requirements in the buy
> >> statement.
> >>
> >> So, I guess I could define buytrigger as simply my exploration
> >> filter, then get the count as you have done below, and amend my buy
> >> statement to require a certain atcb number.
> >>
> >> Let me try this, and thanks to all who have responded.
> >>
> >> Yuki
> >>
> >> Monday, January 30, 2006, 12:16:54 PM, you wrote:
> >>
> >> RS> Something on these lines should be what you need if I have
understood your
> >> RS> conditions correctly:
> >>
> >>
> >> RS> buytrigger=x;
> >>
> >> RS> atcb=atc(buytrigger);
> >>
> >> RS> buy=atcb>=n;
> >>
> >>
> >> RS> R
> >>
> >> RS> On 1/30/06, Yuki Taga <yukitaga@xxxxxxxxxxxxx> wrote:
> >> >>
> >> >>  This is probably startlingly obvious to people who can program, but
I
> >> >> am profoundly algorithmically challenged.  ^_^
> >> >>
> >> >> I have certain symbols that setup according to certain criteria.  I
> >> >> want to *count* those symbols on every trading day, and then base
> >> >> *any* buy on the *count* being at or above a certain number.
> >> >>
> >> >> For example, if I had only 20 setups on one day, I might write the
> >> >> buy to not allow any trades. But if I had 50 setups I might write to
> >> >> buy to take all of the eligible trades that day.
> >> >>
> >> >> I have no problem with my basic code for this system.  But I have no
> >> >> idea how to return a count of the eligibles for any day.  I suppose
I
> >> >> need to define a variable that will be the count, and I'm
practically
> >> >> home free.  But as I say, I don't know how to get that value
> >> >> returned.
> >> >>
> >> >> Yuki
>
>
>
>
>
> 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 other support material please check also:
> http://www.amibroker.com/support.html
>
>
> Yahoo! Groups Links
>
>
>
>
>
>



------------------------ Yahoo! Groups Sponsor --------------------~--> 
Try Online Currency Trading with GFT. Free 50K Demo. Trade 
24 Hours. Commission-Free. 
http://us.click.yahoo.com/RvFikB/9M2KAA/U1CZAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

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 other support material please check also:
http://www.amibroker.com/support.html

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/