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

[amibroker] Re: Holy Grail? NOT!



PureBytes Links

Trading Reference Links

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/