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

[amibroker] Re: Holy Grail? NOT!



PureBytes Links

Trading Reference Links

Dale,

Thanks for pointing out this bug. I thought this equity(1) should 
have taken care of this already as I commented in the code. (matched 
BUY/SELL, SHORT/COVER in pairs.)

It helps a little, but if you would run the 'explore', problems still 
exist. I still see SELL(buy, -20) or COVER(short, -20) not following 
the command. They seem to pop up randomly, at least I could not 
explain why they are there yet.

BTW, in this AFL, LONG and SHORT trades can be initiated 
independently without any SELL or COVER to make a trade go flat 
first. Is there a way to force they come in series, that is when you 
are LONG, there would be no SHORT before the trade goes flat, vice 
versa for SHORT trades? 

I tried using:

Buy = ExRem(Buy, Short);
Short = ExRem(Short, Buy);

to no effect.

Thanks for any suggestions.


Thomas


--- In amibroker@xxxxxxxxxxxxxxx, "msc626 <msc626@xxxx>" 
<msc626@xxxx> wrote:
> Shouldn't it be --
> BUY=ExRemSpan(BUY,wait);
> SHORT=ExRemSpan(Short,wait);
> 
> dale b
> --- In amibroker@xxxxxxxxxxxxxxx, "tchan95014 <tchan95014@xxxx>" 
> <tchan95014@xxxx> wrote:
> > Hi, All,
> > 
> > Apparently some explanation is in order. Please check below along 
> the 
> > AFL code.
> > 
> > BTW, not all tickers have excellent results, there are many also 
> > suffer bad losses.
> > 
> > Any comments are welcome. Thanks.
> > 
> > Thomas
> > 
> > ------------------------------------------------------------------
--
> --
> > -------
> > Hi, All,
> > 
> > When I ran the attached AFL file below on CIEN (daily), it 
generated
> > RAR% > 1900 (from 2000-1-1 to today), which is incredible, look 
> like a
> > holy grail found. I ran more tickers and more ridiculous profit.
> > 
> > However, when I ran the 'explore', I just could not match up my 
code
> > with the output, nor the ARROWS. I do not even understand why the
> > 'explore' output was presented the way it was.
> > 
> > Any kind sould please help, I just could not see what I did wrong.
> > If there is any use of future data, I could find it nor AB.
> > Please run 'backtest', then compare it with the output 
of 'explore'
> > 
> > Thanks.
> > 
> > 
> > Thomas
> > 
> > 
> > // ---------------------------------------------------------------
--
> --
> > ------------------------------------
> > // ATR range breakout system, run on daily bars
> > //
> > // This is a very simple volatility breakout system.
> > // It keys off YESTERDAY's close +/- some multiple of ATR(n), n = 
> 10. 
> > multiple = 0.6 here.
> > // Hence, if TODAY's high > long breakout price determined by 
> > yesterday close (priceB), we go long
> > // if TODAY's low < short breakout price determined by 
yesterday's 
> > close (priceS), we go short
> > // Because of this nature, we have to use SetTradeDelays() on 
> > BUY/SHORT to 0, you set a STOP
> > // price and enter your order before OPEN and wait for execution.
> > // Since we always WAIT 20 days AFTER entry, and we exit our 
> position 
> > on OPEN, there is not much
> > // difference in setting SetTradeDelays() on SELL/CLOSE to 0 or 1.
> > //
> > // If you check, you will see priceB and priceS is YESTERDAY's 
> > breakout prices to be used today.
> > // I like to use TODAY as the base, if any signal occurs today, I 
> can 
> > set the STOP price for tomorrow.
> > // Also, if there is any execution TODAY.
> > //
> > // ---------------------------------------------------------------
--
> --
> > -------------------------------------
> > // System defines
> > // ---------------------------------------------------------------
--
> --
> > -------------------------------------
> > 
> > SetTradeDelays(0, 0, 0, 0);
> > 
> > // ---------------------------------------------------------------
--
> --
> > -------------------------------------
> > // System Parameters
> > // ---------------------------------------------------------------
--
> --
> > -------------------------------------
> > 
> > smoothB = 10;           // 10-bar ATR() is used
> > multipleB = 0.6;        // with 0.6 * ATR(10) as the volatility 
> > breakout range
> > wait = 20;              // wait  20 bars after entry then exit
> > smoothS = smoothB;      // make sure LONG and SHORT uses same 
> > parameters
> > multipleS = multipleB;
> > 
> > entryB = C + multipleB * ATR(smoothB);  // BUY breakout price for 
> > NEXT bar
> > entryS = C - multipleS * ATR(smoothS);  // SHORT breakout price 
for 
> > NEXT bar
> > priceB = Ref(entryB, -1);               // make sure we are using 
> > PREVIOUS bar for our decision making
> > priceS = Ref(entryS, -1);               // make sure we are using 
> > PREVIOUS bar for our decision making
> > 
> > // if TODAY's high > YESTERDAY's Close +/- breakout range, we 
want 
> to 
> > act on.
> > // Because we are using yesterday price, we are pretty much 
setting 
> > up a STOP price
> > // to act, from yesterday's price, on today's price.
> > 
> > CondBuy = IIf(H > priceB, 1, 0);        // priceB is previous bar 
> > price
> > CondShort = IIf(L < priceS, 1, 0);      // priceS is previous bar 
> > price
> > 
> > // ---------------------------------------------------------------
--
> --
> > -------------------------------------
> > // Trading System Rules
> > // ---------------------------------------------------------------
--
> --
> > -------------------------------------
> > 
> > Buy = CondBuy;                          // CondBuy was created 
for 
> > debug only
> > Sell = Ref(Buy, -wait);                 // supposedly a 20 day 
wait 
> > before SELL
> > Short = CondShort;
> > Cover = Ref(Short, -wait);
> > ExRemSpan(Buy, wait);                   // I thought I don't need 
> > this, because
> > ExRemSpan(Short, wait);                 // equity(1) is used 
below 
> > (makes no difference though)
> > 
> > BuyPrice = IIf(Open > priceB, Open, priceB);    // Make sure 
entry 
> > price is realistic
> > ShortPrice = IIf(Open < priceS, Open, priceS);
> > SellPrice = Open;                       // Since we set a 20-day 
> > wait, I assume Sell will onlu
> > CoverPrice = Open;                      // be set to TRUE, 20 
bars 
> > after 'Buy' is triggered
> > 
> > // ---------------------------------------------------------------
--
> --
> > -------------------------------------
> > // Equity info
> > // ---------------------------------------------------------------
--
> --
> > -------------------------------------
> > 
> > Eq = Equity(1);
> > 
> > // ---------------------------------------------------------------
--
> --
> > -------------------------------------
> > // Exploration
> > // ---------------------------------------------------------------
--
> --
> > -------------------------------------
> > 
> > Filter = 1;
> > 
> > AddColumn(O, "Open");
> > AddColumn(H, "High");
> > AddColumn(L, "Low");
> > AddColumn(C, "Close");
> > AddColumn(V, "Volume", 1.0);
> > 
> > AddColumn(CondBuy, "CondBuy");
> > AddColumn(Buy, "Buy", 1.0);
> > AddColumn(Sell, "Sell", 1.0);
> > AddColumn(entryB, "entryB");
> > 
> > AddColumn(CondShort, "CondShort");
> > AddColumn(Short, "Short", 1.0);
> > AddColumn(Cover, "Cover", 1.0);
> > AddColumn(entryS, "entryS");


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/