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

RE: [amibroker] cannot buy on open



PureBytes Links

Trading Reference Links

Yuki
Buy requires a condition to be met and results in a binary 1 or 0. A "1"
gives the signal for the buy to be activated.
Same with the Sell
So you would need a condition to be met :
Buy = Cross(C,EMA(C,20);
Sell = Cross(EMA(C,10),C);
BuyPrice = Open;
SellPrice = Close;
Now you need to apply the settings to buy at open, and sell at close.
Then have your trade delays set to what you require, Buy delay 0 day,
and sell at 0 days. You can do this with the command
SetTradeDelays(0,0,0,0);

Check if these are the correct spellings in the AB help pages. Hope this
works, I have not tested it but will if you have problems with it, or
maybe someone else will have  abetter response.

Oh, by the way, do not consider your questions sill or basic because
often they make me stop and think about things and how I can improve my
coding.

Cheers,
Graham
 

-----Original Message-----
From: Yuki Taga [mailto:yukitaga@xxxxxxxxxxxxx] 
Sent: Sunday, 23 February 2003 9:18 AM
To: amibroker@xxxxxxxxxxxxxxx
Subject: [amibroker] cannot buy on open

Sometimes the apparently simplest things are not, in AB.

I cannot seem to make it buy on the open and sell on the close the
same day, no matter what formula I enter.  Everything is done on the
close.  This is regardless of what I have in 'settings', and
regardless of what I write in code to control those settings.

Even a brain-dead:

Buy = Open; //nothing more, we'd buy every open and sell every close

Sell = Close;

SetTradeDelays(0,0,0,0);

BuyPrice = Open;

SellPrice = Close;

results in all buys and sells taking place on the close, at the same
price, of course. Can someone explain why I cannot control this?

Yuki ^_^

mailto:yukitaga@xxxxxxxxxxxxx


Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)

Check group FAQ at:
http://groups.yahoo.com/group/amibroker/files/groupfaq.html 

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



Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)

Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 

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