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

[amibroker] Re: How to Repeatedly Buy @ Close, Sell @ Open?



PureBytes Links

Trading Reference Links

Good thought, but it still behaves the same way. I think what I'm 
looking for is something like a new option "AllowSameBarEntry", 
because "AllowSameBarExit" is disallowing me from closing & re-
opening a new trade in the same day, when all it should really do is 
prevent me from opening & closing the same trade in the same day.


--- In amibroker@xxxxxxxxxxxxxxx, "Steve Dugas" <sjdugas@xxx> wrote:
>
> What if you tried swapping the arrays around?  I haven't tried it, 
just a 
> thought...
> 
> TempClose = Open;
> TempOpen = ref( Close, -1 );
> BuyPrice = TempOpen;
> SellPrice = TempClose;
> Buy = Sell = 1;
> 
> Steve
> 
> ----- Original Message ----- 
> From: "onlyobsession2k3" <jmpatton@xxx>
> To: <amibroker@xxxxxxxxxxxxxxx>
> Sent: Sunday, November 12, 2006 11:22 PM
> Subject: [amibroker] How to Repeatedly Buy @ Close, Sell @ Open?
> 
> 
> > I'm trying to code a simple system that repeatedly buys at the 
Close
> > and sells at the next day's Open. It sounds simple, but I can't 
figure
> > out the correct combination of options to allow this.
> >
> > My basic Buy/Sell criteria is:
> > Buy = True;
> > BuyPrice = Close;
> > Sell = Ref(Buy,-1);
> > SellPrice = Open;
> >
> > -If I use SetOption("AllowSameBarExit", False) then I cannot sell 
and
> > buy on the same day, e.g. I cannot sell in the morning and buy the
> > same afternoon. The script will instead select different stocks 
to buy
> > even though the stocks sold that morning have a higher position 
score.
> > -If I use SetOption("AllowSameBarExit", True), then the above AFL 
buys
> > and sells on the same day instead of holding overnight.
> > -ExRemSpan(Buy,1) has the same problem as above, it can't sell & 
rebuy
> > on the same day.
> > -I thought SetOption("HoldMinBars",2) looked promising, but when 
I try
> > that I get an error message stating that I can't use HoldMinBar 
unless
> > AllowSameBarExit is also False. Again, see above.
> >
> > Does anyone know how to do this? I've spent quite a bit of time 
on it
> > and I'm thinking it may be an oversight/limitation of the current 
AFL
> > language options. Thanks for any help,
> >
> > -Joel
> >
> >
> >
> >
> > 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
> >
> >
> >
> >
> >
>




Content-Description: "AVG certification"
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.409 / Virus Database: 268.14.11/542 - Release Date: 11/20/2006