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

[amibroker] Re: How to "Enter Long" at Open on Next Day



PureBytes Links

Trading Reference Links

Tomasz, can I overide the Automatic Analysis -> Settings -> Trades and
leave the defaults set to "Open" and "0" for both Buys and Sells and
instead code the system to tell it to buy and/or sell on the next day?
See Code below.

example: 

Buy = Ref(Buy,-1); BuyPrice = Open;

Sell = Ref(Sell,-1); SellPrice = Open;

(I am not sure what this is telling me, but I believe the first part
"Ref(Buy,-1); BuyPrice = Open;" is telling Amibroker to Refer to the
Buy price one day ago and Buy today at the Open. 

Likewise for the Sell side (Exit Long). "Ref(Sell,-1); SellPrice =
Open;" is telling Amibroker to refer to the Sell price one day ago and
Sell today at the Open.

//Example of complete code.

Cond1 = Close > MA( Close, 20 );
Cond2 = Close > MA( Close, 80 );
Cond3 = Close > MA( Close, 150 );
Buy = Cond1 AND Cond2 AND Cond3 ;
Buy = Ref(Buy,-1); BuyPrice = Open;


Cond4 = Close < MA( Close, 20 );
Cond5 = Close < MA( Close, 80 );
Cond6 = Close < MA( Close, 150 );
Sell = Cond4 AND Cond5 AND Cond6 ;
Sell = Ref(Sell,-1); SellPrice = Open;

Thank you
Wally




--- In amibroker@xxxxxxxxxxxxxxx, "electricwally77" <soundmaker@xxx>
wrote:
>
> Thank you. It worked! 
> 
> 
> --- In amibroker@xxxxxxxxxxxxxxx, "Tomasz Janeczko" <groups@> wrote:
> >
> > Set Trade delay to 1 and price to open in the Automatic Analysis ->
> Settings
> > 
> > Best regards,
> > Tomasz Janeczko
> > amibroker.com
> > ----- Original Message ----- 
> > From: "electricwally77" <soundmaker@>
> > To: <amibroker@xxxxxxxxxxxxxxx>
> > Sent: Tuesday, October 21, 2008 1:23 AM
> > Subject: [amibroker] How to "Enter Long" at Open on Next Day
> > 
> > 
> > >I appreciate any code help if possible.
> > > 
> > > I've been at my code for hours and can't figure out what I did
wrong.
> > > 
> > > I'm trying to tell my system to Enter Long on the Next Trading
Day (at
> > > the open price) only if the "Buy" rules are True the trading day
> before.
> > > 
> > > Likewise, I'm trying to tell my system to Exit Long on the Next
> > > Trading Day (at the open price) only if the "Sell" rules are
True the
> > > trading day before.
> > > 
> > > In other words, If my system tells me to buy or sell on a particular
> > > day, I only want to execute the trade at the open on the next
trading
> > > day (not the same day the system identifies a trade).
> > > 
> > > Here is my code below:
> > > 
> > > Cond1 = Ref(Close,-1); BuyPrice = Open;
> > > Cond2 = Close > MA( Close, 20 );
> > > Cond3 = MA(  Close , 20 ) > MA(  Close , 80 ); 
> > > Cond4 = MA(  Close , 20 ) > MA(  Close , 150 ); 
> > > Buy = Cond1 AND Cond2 AND Cond3 AND Cond4; 
> > > 
> > > Cond4 = Ref(Close,-1); SellPrice = Open;
> > > Cond5 = Close < MA( Close, 20 );
> > > Cond6 = MA(  Close , 20 ) < MA(  Close , 80 ); 
> > > Cond7 = MA(  Close , 20 ) < MA(  Close , 150 );
> > > Sell = Cond4 AND Cond5 AND Cond6 AND Cond7;
> > > 
> > > Thanks you members.
> > > 
> > > 
> > > ------------------------------------
> > > 
> > > **** IMPORTANT ****
> > > This group is for the discussion between users only.
> > > This is *NOT* technical support channel.
> > > 
> > > *********************
> > > TO GET TECHNICAL 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
> > > 
> > > 
> > >
> >
>



------------------------------------

**** IMPORTANT ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

*********************
TO GET TECHNICAL 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

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

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> 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/