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

[amibroker] Re: I want to sell a stock on next bar open what will be the code



PureBytes Links

Trading Reference Links

I think the problem is that with 1 bar delay and Sell always True, 
on the day when your buy condition is true, your sell will be true, 
as well (as it was the day before and the day before) hence the buy 
will not be executed ("we already had a sell and can't trade anymore 
on this bar with delay = 1).
I think you must allow same day in-and-out by saying:

SetTradeDelays( 0, 0, 1, 1 );
SetOption( "AllowSameBarExit", True ) ;

and change the sell condition to trigger after a buy only, not 
before. The ExRem function is helpful for that:

Buy = ExRem(Buy,Sell);
or 

Sell = ExRem (Sell, Buy);

(I am a newbie, too, so I can not at the spur of the moment tell you 
which one is the one to use, I think it's the latter, which means: 
no sell signal until a buy happens ).

André


--- In amibroker@xxxxxxxxxxxxxxx, SHIRBHATE SHIRISH 
<sshirbhate@xxxx> wrote:
> Hi Graham,
>  Thanks for your early reply,
> I want to buy a stock at close if the price is
> more than 5% up and sell at open next day.
>  I wrote the following code but it is not
> working properly
> 
> SetTradeDelays(0,1,1,1);
> Buy = Close >  Ref(Close, -1)*1.05;
> BuyPrice = C;
> Sell = True;
> SellPrice = O; //sell price is open
> 
> Thanks
> 
> Shirish
> 
> --- Graham <kavemanperth@xxxx> wrote:
> > SetTradeDelays(1,1,1,1); //sets buy/sell/short/cover
> > to 1 bar delay
> > after the signal bar
> > SellPrice = O; //sell price is open
> > 
> > 
> > On 5/21/05, sshirbhate <sshirbhate@xxxx> wrote:
> > > dear friends,
> > >  I want to sell a stock on open on the next bar
> > > 
> > > what will be the code.
> > > 
> > > Thanks in advance
> > > 
> > > Shirish
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 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
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > 
> > 
> > -- 
> > Cheers
> > Graham
> > http://e-wire.net.au/~eb_kavan/
> > 
> 
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around 
> http://mail.yahoo.com




------------------------ Yahoo! Groups Sponsor --------------------~--> 
What would our lives be like without music, dance, and theater?
Donate or volunteer in the arts today at Network for Good!
http://us.click.yahoo.com/Tcy2bD/SOnJAA/cosFAA/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/