PureBytes Links
Trading Reference Links
|
Thomas,
A few weeks ago, Tomasz demonstrated another way to accomplish trade
delays. (The purpose of this method was to facilitate backtesting and
exploration with the same afl script).
This is an example:
SetTradeDelays(0,0,0,0); // Control my own delays later
lastbar = BarIndex() == BarCount - 1;
delay = IIf( lastbar, 0, 1 ); // one bar delay EXCEPT last bar
Buy = cond;
Buy = Ref( Buy, -delay ); // Shifts Buy array by delay
I notice thru examples posted by others that a few people adapted this
method of handling trade delays (including myself). I like this method
because it keeps my mind wrapped around the concept of AB's array
processing methodology.
To clarify a post that I read earlier... be aware that BuyPrice and
SellPrice are arrays just like O, H, L, C & V.
I know that the above did not provide you with a direct answer to your
query, but you might want to think a bit about it, and note how the
array elements can be shifted using this method.
Good Luck,
Phsst
--- In amibroker@xxxxxxxxxxxxxxx, "tchan95014" <tchan@xxxx> wrote:
> Hi, Graham,
>
> Thanks. Unfortunately, by setting trade delay to 0 has its
> disadvantages:
> 1) I am a EOD user, I want to see the signal tonight and place order
> for tomorrow.
> 2) As I stated in my email, it would make some of my other conditions
> in the system very complicated.
>
> I still think, if the buyprice set by the user is NOT within the H/L
> range for the day of execution, there should be NO trade.
>
> Anyway, thanks again.
>
>
> Thomas
>
>
> --- In amibroker@xxxxxxxxxxxxxxx, "Graham" <gkavanagh@xxxx> wrote:
> > Thomas, I think BuyPrice is just a definition of the price you buy
> at when
> > given a signal price. If you want to include tomorrows price in the
> buy
> > condition then make the price part of the buy signal
> > eg Buy = Cond and PriceCond;
> > then set your delay to 0.
> >
> > Cheers,
> > Graham
> > http://groups.msn.com/asxsharetrading
> > http://groups.msn.com/fmsaustralia
> >
> > -----Original Message-----
> > From: tchan95014 [mailto:tchan@x...]
> > Sent: Sunday, 11 January 2004 9:49 AM
> > To: amibroker@xxxxxxxxxxxxxxx
> > Subject: [amibroker] How to implement BUY/SELL stop order
> >
> >
> > Hello,
> >
> > I tried the following to implement a BUY stop, I want to buy only if
> > tomorrow's price rises above a predefined price. For example,
> today's
> > HIGH + 0.1. The trade delay is 1.
> >
> >
> > Buy = upTrend AND bLCondx;
> > BuyPrice = IIf(H >= bLStopP, IIf(Open >= bLStopP, Open, bLStopP),
> > 999999);
> >
> > Since there are days even though the BUY = 1 but the next day's
> price
> > does NOT go up to satisfy this H >= bLStopP condition, in this case
> I
> > want to skip it. In my test I found that AB ALWAYS execute a trade
> if
> > buy = 1, even though the BuyPrice is NOT satisfied, AB would buy
> using
> > the HIGH of the entry day.
> >
> > In my opinion, BuyPrice is also a condition to be satisfied, as long
> > as an user specify a price to be filled, it becomes a condtion. But
> AB
> > sees it differently.
> >
> > What is the best way to do this? Do I have to look into the future
> to
> > decide my BUY condition? I do NOT want to use SetTradeDelays(0, 0,
> 0,
> > 0) since it makes my other conditions very complicated.
> >
> > Thanks for any help...
> >
> >
> >
> > Thomas
> >
> >
> > Send BUG REPORTS to bugs@xxxx
> > Send SUGGESTIONS to suggest@xxxx
> > -----------------------------------------
> > 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
> >
> > 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/
Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@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
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/
|