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

Re: [amibroker] Re: Holy Grail? NOT!



PureBytes Links

Trading Reference Links

Thomas,

Please understand I don't debug / fix user's code because
it is exteremely time consuming and if I did I would not have time
to do anything more.
See http://www.amibroker.com/freesupport.html


I only can fix errors in AmiBroker itself if you provide me
with bug report showing incorrect calculations.

I looked at your code and you have lots of coding errors in it.
For example you write:

ExRemSpan(Buy, wait); // I thought I don't need 

this unfortunatelly has no effect. ExRemSpan is a FUNCTION
and it's result value HAVE TO BE ASSIGNED to the variable.
Correct usage is:

Buy = ExRemSpan(Buy, wait); // ASSIGNMENT !!!!!!!!!!!! 


Also ExRemSpans are placed incorrectly (they should be placed
before Cover = Ref(Short, -wait);,  not after

etc, etc....



Best regards,
Tomasz Janeczko
amibroker.com
----- Original Message ----- 
From: <tchan95014@xxxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Monday, February 10, 2003 10:45 PM
Subject: [amibroker] Re: Holy Grail? NOT!


> Hi, TJ,
> 
> sigh! Please check my code, [priceB] and [priceS], I have used ref
> (xxx, -1) to push both condition one bar back already.
> 
> I am pretty much sitting on the TRADING day to look back the previous 
> bar to see if there is any SIGNAL generated YESTERDAY, if YES, and if 
> TODAY's high is higher than the breakout price established YESTERDAY, 
> then I get stopped in from an order I can put in YESTERDAY after the 
> close.
> 
> 
> Thomas
> 
> --- In amibroker@xxxxxxxxxxxxxxx, "Tomasz Janeczko" <amibroker@xxxx> 
> wrote:
> > Hello,
> > 
> > ATR (that you are using) usesC/H/L of CURRENT bar also. therefore 
> you can not trade
> > on open with zero delay.
> > 
> > Best regards,
> > Tomasz Janeczko
> > amibroker.com
> > ----- Original Message ----- 
> > From: <tchan95014@xxxx>
> > To: <amibroker@xxxxxxxxxxxxxxx>
> > Sent: Monday, February 10, 2003 8:41 PM
> > Subject: [amibroker] Re: Holy Grail? NOT!
> > 
> > 
> > Hi, Jim,
> > 
> > If you could kindly re-read my comment on the AFL code.
> > 
> > There I mentioned that I am using the breakout price generated on 
> > YESTERDAY's close, if TODAY's high is higher
> > than the long breakout price, then long, if TODAY's low is lower 
> than 
> > the short breakout price, then short.
> > Since the breakout price is set the day before, one can always 
> enter 
> > a STOP price order and
> > wait for it to be triggered. That is, you enter a STOP order after 
> > the CLOSE yesterday, and if TODAY's price
> > go across the breakout price, that STOP price is triggered 
> > automatically, apparently I am waiting TODAY for
> > this STOP price to be triggered, so there should be NO trade delay.
> > 
> > NOTE: I do not use the info from [settings...], I define my own 
> > buyprice/sellprice/shortprice/coverprice.
> > 
> > Please check the [priceB] and [priceS], I have used ref(xxx, -1) to 
> > ensure I am using the previous day's breakout
> > price.
> > 
> > I have my mind set on the TRADING day not on SIGNAL generation day, 
> I 
> > guess that is the reason why it caused so many confusions. But, 
> > again, I have carefully pushed back the SIGNAL tested one bar 
> already.
> > 
> > 
> > 
> > Fred,
> > 
> > Yes, it is possible to trade with trade delay 0 on OPEN, if you 
> have 
> > set the SELL = ref(buy, -20) for example.
> > That is, if you have a BUY 20 bars ago, today and only today the 
> SELL 
> > is triggered, of course you can set the
> > trade delay to 0 because the trade was initiated 20 days ago. 
> > 
> > Of course, only if this SELL = ref(buy, -20) works correctly for 
> me, 
> > especially when there are potentially 
> > more than one BUY signals are triggered. That is also why I urged 
> > those who tried my AFL code to check the
> > 'explore' I just could not see where this SELL = ref(BUY, -20) 
> > happening.
> > 
> > 
> > 
> > 
> > Thomas
> > 
> > 
> > --- In amibroker@xxxxxxxxxxxxxxx, "Fred <fctonetti@xxxx>" 
> > <fctonetti@xxxx> wrote:
> > > Jim,
> > > 
> > > Although it's not possible to trade with delay 0 on the open it 
> is 
> > > certainly possible and feasible to trade with delay 0 on close.  
> > One 
> > > may not get 100% of the signals correct but the small amount of 
> > > errors will for the most part balance each other out.  I do this 
> > > EVERY day.
> > > 
> > > Fred
> > > 
> > > --- In amibroker@xxxxxxxxxxxxxxx, "Jim Hutchison" <phutch@xxxx> 
> > wrote:
> > > > Your system will get a high return on account because there is 
> no 
> > > trade
> > > > delay set "SetTradeDelays(0, 0, 0, 0);". You are buying or 
> > selling 
> > > at
> > > > the close on the same day the trading signal is generated. 
> Which 
> > > would
> > > > not be possible in real life. You can not trade at the close 
> > after 
> > > the
> > > > close.
> > > > 
> > > > Jim Hutchison
> > > > 
> > > > 
> > > > -----Original Message-----
> > > > From: tchan95014 <tchan95014@xxxx> [mailto:tchan95014@x...] 
> > > > Sent: Monday, February 10, 2003 1:01 PM
> > > > To: amibroker@xxxxxxxxxxxxxxx
> > > > Subject: [amibroker] Re: Holy Grail? NOT!
> > > > 
> > > > 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");
> > > > 
> > > > 
> > > > 
> > > > 
> > > > Yahoo! Groups Sponsor
> > > > ADVERTISEMENT
> > > > 
> > > > 
> > > > 
> > > > 
> > > > 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 the Yahoo! Terms of 
> > Service.
> > 
> > 
> > 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/ 
> 
> 
>

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/