Quantcast Amibroker FAQ - Aussie Stock Forums - Page 75

Page 75 of 91 FirstFirst ... 2565737475767785 ... LastLast
Results 1,481 to 1,500 of 1814

Thread: Amibroker FAQ

  1. #1481

  2. #1482

  3. #1483

    Default Re: Amibroker FAQ

    The Report


    Report.PNG

  4. #1484

    Default Re: Amibroker FAQ

    I'll have another look tomorrow if you still haven't figured it out, I'd like to know the difference as well. But using the same setup as you (apart from commission table which I can't see, mine is no commission) I get a CAR of 10.04%.

    My backtest did 252 trades, yours did 101, GB's did 327.

    Some of the difference may be data. I use Norgate Premium Data.

    If you haven't seen it already, this tutorial on the Amibroker site may be of interest:
    http://www.amibroker.com/guide/h_backtest.html

  5. #1485

    Default Re: Amibroker FAQ

    Quote Originally Posted by art27 View Post
    Thanks guys. Yes Ive never done porfolio testing before so Im trying to learn. Ive saved my amibroker backetest settings .abs How do i upload them?

    Here is the report

    Attachment 46943
    Sorry, missed that post! Rename the file extension .abs to .txt and then upload it via manage attachments. So anyone can download that file and rename txt back to abs again.Too bad this forum doesn't allow zip or rar archives. At least I can not see them listed.

  6. #1486

    Default Re: Amibroker FAQ

    Quote Originally Posted by trash View Post
    Sorry, missed that post! Rename the file extension .abs to .txt and then upload it via manage attachments. So anyone can download that file and rename txt back to abs again.Too bad this forum doesn't allow zip or rar archives. At least I can not see them listed.
    Yes it could be a data issue. Im currently in the building system - Paper Trading stage so I thought that historical yahoo data would be ok. Yesterday I started to suspect the data but what I do find interesting is the variance in results that you guys are having. Im also totally new to "Portfolio" backtesting although Ive had a lot of experience with individual backtest on one stock. Im happy to buy some historical data but it seems to come cheaper if you sign up for end of day data as well which I didnt intend to do until I was ready to trade.

    To do a portfolio backtest you just click BACKTEST then PORTFOLIO BACKTEST and then look at the report?

    Sorry I took up so much room on the thread with the images. I couldnt see any way of uploading my settings except as images.

    Here are the settings renamed to txt from abs
    My Backtest Settings.txt

  7. #1487

    Default Re: Amibroker FAQ

    Something in your code seems to be wrong. When using exploration no results are getting displayed. Your equity curve looks very strange when using your settings. When using default settings then no results are getting displayed in backtest also. I have not checked your code but something is wrong there.

    I have used ^AORD of Yahoo 1/1/2004 to 20/4/2012.

  8. #1488

    Default Re: Amibroker FAQ

    When plotting your code only sell shapes are getting displayed. So your Buy logic seems to be fishy.

    EDIT: it's because of condition 5: c<10
    ^AORD is bigger 10

    EDIT 2:

    Quote Originally Posted by art27 View Post
    Ive backtested it on asx all ords from 1/1/2004 to 20/4/2012.
    Please provide the list of symbols. I'm not familiar with ASX. Export the list of symbols using Amiquote. Use Files-Save as... there and export as txt file.

  9. #1489

    Default Re: Amibroker FAQ

    Quote Originally Posted by art27 View Post
    Hello

    Ive been trying to learn how to set up and backtest a few systems and I must have a problem because all of them give very low results. I have attached a afl of techtrader that I have. Ive backtested it on asx all ords from 1/1/2004 to 20/4/2012. I click backtest-portfolio backtest and then I click on report. The report that I get says that the annual return was 2.54%. Could someone please backtest this afl and tell me what the results are. Thank you
    What do you wanna prove anyway? I don't quite get it. Do you wanna prove AB being wrong because ... ? I doubt you will succeed.

  10. #1490

    Default Re: Amibroker FAQ

    Quote Originally Posted by art27 View Post
    The Report


    Report.PNG
    This is what's different in my settings:

    Allow position size shrinking - checked
    Use quick AFL - checked
    Commission - .11% (not sure what you've defined)
    Interest rate - 0%
    Buy/Sell delays - zero
    Buy - close, sell - close
    Max open posns - 1000
    Limited to 2% of prev days volume

    Buy/sell delay will make a huge difference. The reason I don't use delay is because it's quite possible to anticipate in the open/closing auction whether you have a trade to make, so long as you're not trying to place 10 trades at once. One or two is easy.

  11. #1491

    Default Re: Amibroker FAQ

    Quote Originally Posted by joshsmi View Post
    What do you wanna prove anyway? I don't quite get it. Do you wanna prove AB being wrong because ... ? I doubt you will succeed.
    Hi Joshsmi.
    Im trying to determine if the problem is my data, my backtester setup or probably least likely my afl code since this was copied from the techtrader forum. A couple of things that you mentioned.
    1. Im testing on the AORD Yahoo tickers. All 500 of them
    2. C<10 You said AORD is bigger than $10. AORD the index is bigger but the 500 shares that make up the index are not all bigger than $10 and its those shares that Im testing on.

    Hi Gringotts Bank.
    Thanks for the settings. I will alter mine and see if that helps. I am interested if most people here have similar settings. From the reading that I have done the number of positions should be between 10 and 20 to be manageable and also to make position sizing work.
    Regarding entry next open, I understand what you are saying. I selected the next days open because most of the systems that have been published seem to do that. Even the techtrader system was already like that. I have not changed it. As for allow position size shrinking Im trying to have 10 equal sized positions.
    Just curious what others are doing. Maybe my settings are wrong. I tend to think its the data or the settings thats why I thought if a few people copied the same formula and tested it I could compare.

    Appreciate all the replies.

  12. #1492

    Default Re: Amibroker FAQ

    Quote Originally Posted by art27 View Post
    Hi Gringotts Bank.
    Thanks for the settings. I will alter mine and see if that helps. I am interested if most people here have similar settings. From the reading that I have done the number of positions should be between 10 and 20 to be manageable and also to make position sizing work.
    Regarding entry next open, I understand what you are saying. I selected the next days open because most of the systems that have been published seem to do that. Even the techtrader system was already like that. I have not changed it. As for allow position size shrinking Im trying to have 10 equal sized positions.
    Just curious what others are doing.
    To determine max number of positions you need to consider what's best for your system and what risk is involved. Spreading your account over 20 stocks is obviously safer than putting 100% of your capital in one stock. But more positions means more commissions. Also, if your system doesn't trade very frequently, having too many positions makes the system slow to get fully invested because it takes a long time to fill all your positions. And if you use margin you need to consider portfolio heat. i.e. what if the market tanks tomorrow and all your open positions get stopped out at the same time?

    Most people designing an end of day system should use entry on next day open. If your system uses the closing price to generate a signal then the stock won't appear in your scan until after the close. If you use end of day data you can't run the scan until after you get the data anyway. If you have a day job you probably can't be sitting around watching live data at the end of the day. You need to select the setting that matches what you will do in real life.

    As for joshsmi's comment on what are you trying to prove? You're trying to prove that your backtested results are realistic and accurate. Rather than the result of some glitch because you didn't set the backtesting settings up correctly. You're doing the right thing. It's important to understand the system you're using as well as ensuring that the backtested results are accurate.

  13. #1493

    Default Re: Amibroker FAQ

    Maybe off topic for an amibroker thread, but still code related...

    Also as a quick side note. For techtrader there is another buy condition that should be added to the code if you want more realistic results. I tested the system a year or so ago and noticed that many trades are taken while price is under the 180 EMA of the low. Since the sell condition is a cross down through the 180 EMA of the low, you don't want to take trades when the price is already below that level.

    In real trading, techtrader is intended to be used with a couple of discretionary rules that would keep you out of these trades anyway. But for backtesting accuracy, don't let the system take trades you wouldn't take yourself.

  14. #1494

    Default Re: Amibroker FAQ

    Quote Originally Posted by Lone Wolf View Post
    As for joshsmi's comment on what are you trying to prove? You're trying to prove that your backtested results are realistic and accurate. Rather than the result of some glitch because you didn't set the backtesting settings up correctly. You're doing the right thing. It's important to understand the system you're using as well as ensuring that the backtested results are accurate.
    Of course he is looking for accuracy. Who doesn't? To me it wasn't clear whether he was looking for errors in his code, his settings or AB's processing. In 99% of cases it's user error.

  15. #1495

    Default Re: Amibroker FAQ

    Thanks for the reply Lone Wolf. You raised a lot of things there that I can have a look at. This morning I purchased premium historical data so Im about to set that up and see if that is my problem. I suspect that the yahoo data is part of it. I was not aware that the tech trader afl needed to be altered to only buy above the 180 EMA. I thought it relied on the highest highs to generate a buy but I see what you are saying so I will test it out anyway. Hopefully I will work out why every system I test is only making around 3% pa. Something is wrong.

    Thanks for the help.

  16. #1496

    Default Re: Amibroker FAQ

    Quote Originally Posted by art27 View Post
    Thanks guys. Yes Ive never done porfolio testing before so Im trying to learn. Ive saved my amibroker backetest settings .abs How do i upload them?

    Here is the report

    Attachment 46943
    The code appears OK
    Although I use metastock.

    Use the ASX 200
    Infact the data base I used when designing it was the BT Margin list.
    The ASX 200 is pretty close.

    See how that goes.

    I also note your start date is 2000 and finish 2004.
    Does your results include open equity in trades still open at your close off date-- or only CLOSED trades.This could be one big reason.
    Average trade length is just over a year,so there are often trades with heaps of equity still open.

    I note average bars held at 5.

  17. #1497

    Default Re: Amibroker FAQ

    Ok I have backtested the Techtader afl attached to this post. I have added some backtester settings to the code and I am now testing on premium data and Im having some success!

    I tested from 1/1/2004 to 20/4/12 on the asx200 since that is the index the system was designed for. Initial cap $100,000 10 positions Buy Sell delay following days open.
    Commission is $15 or 0.20% whicher is the greater.

    I get

    Annual return of 15.26% Is this the CAR?
    Exposure 82.57%
    61 trades (31.2% win)
    Max Sys DD -35.70%
    Car/MaxDD 0.43
    Payoff Ratio 4.06

    These results look better and I think thats due to the data however I may still have a problem with the back test settings.

    Im unsure about

    Allow position size shrinking. It is unticked. I think that should be un ticked because I want the equity divided by 10

    Allow same bar exit entry is unticked.

    Min Shares is set at 1

    Min pos value is set at 0

    Activate stops immediately ( when turned on, stops are checked AFTER current bar signals) Is unchecked

    Limit trade size to % of entry bar volume is set at 10

    Can someone please confirm that these are correct and if possible run a backtest for me on the asx200 for the following formula for the above dates to confirm my results


    Thank you

    Code:
    //Plot Price Chart
    
    SetChartOptions(0,chartShowArrows|chartShowDates);
    _N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
    Plot( C, "Close", ParamColor("Color", colorBlack ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() ); 
    SetBarsRequired( sbrAll, sbrAll);
    
    // Techtrader v2 amibroker version
    
    
    //Backtester settings
    
    
    SetOption("InitialEquity", 100000 ); // Initial trading equity of 100000
    SetOption("MaxOpenPositions", 10 ); // This sets maximum number of open positions
    PositionSize = -10; // Always invest only 10% of the current Equity 
    
    SetOption("CommissionMode",0); //Use Commissions Table in Backtester. Min $15 per trade or 0.20% whichever is the larger.
    SetTradeDelays(1,1,1,1); // Delay Entry and Exit by one day.
    BuyPrice=Open;
    SellPrice=Open;
    
    
    
    
    
    // Here we define buy conditions and name each one as a variable
    
    
    cond1=Cross(H,Ref(HHV(H,10),-1)); // when todays high crosses last highest high over the last 10 periods
    cond2=H > EMA(C,40); // todays high is greater than the 40 day Exp MA of closes
    cond3=HHVBars(H,70) == 0; // todays high is the highest for 70 periods
    cond4=EMA(V*C,21) > 500000; // ensure at least $500k of money flow
    cond5=C < 10; // only trading in stocks less than $10
    cond6=C > O; // todays close higher than open
    
    // The following line is the trigger if all conditions satisfied
    Buy=cond1 AND cond2 AND cond3 AND cond4 AND cond5 AND cond6;
    
    //--------------------------------------------------------------------------------------------------------------------
    
    // Here we define variables used once in the trade
    
    ApplyStop( stopTypeLoss, stopModePercent, amount=10 );
    Sell= Cross(Ref(EMA(L,180),-1),C); // close crosses below yesterdays average of the low
    
    //-------------------------------------------------------------------------------------------------------------------
    
    // Here we define what gets displayed on the chart
    
    PlotShapes(Buy*shapeUpArrow,colorGreen,0,Low);
    PlotShapes(Sell*shapeDownArrow,colorRed,0,High);
    
    //-------------------------------------------------------------------------------------------------------------------
    
    //Exploration
    
    Filter = cond1 AND cond2 AND cond3 AND cond4 AND cond5 AND cond6;
     // lists exploration results conforming to our buy criteria
    AddColumn(Buy, "buy", 1.0); //
    //Filter = Sell; // lists exploration results conforming to our buy criteria
    //AddColumn(Sell, "sell", 1.0); //
    
    // This section creates the data that you can plot to see how often TT2 trades
    // NOTE:- Using VOLUME array so get correct number when switching to WEEKLY or MONTHLY display
    AddToComposite(Buy,"~TTBuys","V");
    AddToComposite(Sell,"~TTSells","V");
    
    Buy = ExRem(Buy,Sell) ;
    Sell = ExRem(Sell, Buy);
    Binary = Flip(Buy , Sell);
    
    
    //-----------------------------------------------------------------------------------------------------------------
    
    //EMAs
    
    _SECTION_BEGIN("EMA 40");
    P = ParamField("Price field",-1);
    Periods = Param("Periods", 40, 2, 300, 1 );
    Plot( EMA( P, Periods ), _DEFAULT_NAME(), ParamColor( "Color", colorBlueGrey ), ParamStyle("Style"),styleThick ); 
    _SECTION_END();
    
    _SECTION_BEGIN("EMA 180");
    P = ParamField("Price field",-1);
    Periods = Param("Periods", 180, 2, 300, 1 );
    Plot( EMA( L, Periods ), _DEFAULT_NAME(), colorOrange , ParamStyle("Style"),styleThick ); 
    _SECTION_END();
    
    
    //----------------------------------------------------------------------------------------------------------------
    
    //Highest High Plotting
    
    
    _SECTION_BEGIN("HHV Long term Entry");
    HHVlongtermPeriod=Param("HHV Long termPeriod",70,1,50);
    LongPeriodEntry=HHV(H,HHVLongtermPeriod);
    Plot (LongperiodEntry," Highest High 70 Days ",colorRed,styleLine);
    _SECTION_END();
    
    _SECTION_BEGIN("HHV Short term Entry");
    HHVshorttermPeriod=Param("HHV short term Period",10,1,50);
    ShortperiodEntry=HHV(H,HHVshorttermPeriod);
    Plot (ShortperiodEntry," Highest High 10 Days ",colorBlue,styleLine);
    _SECTION_END();

  18. #1498

    Default Re: Amibroker FAQ

    Quote Originally Posted by tech/a View Post
    The code appears OK
    Although I use metastock.

    Use the ASX 200
    Infact the data base I used when designing it was the BT Margin list.
    The ASX 200 is pretty close.

    See how that goes.

    I also note your start date is 2000 and finish 2004.
    Does your results include open equity in trades still open at your close off date-- or only CLOSED trades.This could be one big reason.
    Average trade length is just over a year,so there are often trades with heaps of equity still open.

    I note average bars held at 5.
    Hi Tech

    Thanks for the reply. I just posted another one then I saw yours. Ive since tested it on the XJO with premium data and Ive got better results.
    You said "Does your results include open equity in trades still open at your close off date-- or only CLOSED trades.This could be one big reason."

    I understand what you are asking but I dont know how to find that out? I have checked the backtester and it doesnt have a setting for that. Sorry not sure how to find out.

  19. #1499

    Default Re: Amibroker FAQ

    Quote Originally Posted by tech/a View Post
    The code appears OK
    Although I use metastock.

    Use the ASX 200
    Infact the data base I used when designing it was the BT Margin list.
    The ASX 200 is pretty close.

    See how that goes.

    I also note your start date is 2000 and finish 2004.
    Does your results include open equity in trades still open at your close off date-- or only CLOSED trades.This could be one big reason.
    Average trade length is just over a year,so there are often trades with heaps of equity still open.

    I note average bars held at 5.
    Did you see this? (The comments above)

    Try over a longer timeframe like double.

    Sorry we crossed.
    Post the results up again on the longer version.
    Tradesim has "include open equity" perhaps you have something like that.

  20. #1500

    Default Re: Amibroker FAQ

    Quote Originally Posted by art27 View Post
    "Does your results include open equity in trades still open at your close off date-- or only CLOSED trades.This could be one big reason."

    I understand what you are asking but I dont know how to find that out? I have checked the backtester and it doesnt have a setting for that. Sorry not sure how to find out.
    The Amibroker backtest report includes both closed and open trades so it's not an issue.

    I'd also remove the exrem statements from the backtest version as the backtester handles trade processing and it's incorrect to use exrem in a backtest. TJ has posted about this issue, I'll see if I can dig it up.

Similar Threads

  1. How to get Amibroker to get automatic Yahoo ASX data feed?
    By flyhigher in forum Software and Data
    Replies: 23
    Last Post: 2nd-March-2011, 02:20 AM
  2. AmiBroker to TradeSim & Monte Carlo testing
    By stevo in forum Software and Data
    Replies: 15
    Last Post: 3rd-December-2009, 04:19 PM
  3. TechTrader With AmiBroker
    By Peakey in forum Software and Data
    Replies: 9
    Last Post: 31st-October-2009, 11:05 PM
  4. Getting EOD data into Amibroker (www.float.com.au)?
    By markrmau in forum Software and Data
    Replies: 36
    Last Post: 29th-December-2008, 12:57 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Aussie Stock Forums