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

[amibroker] Re: backtesting a watchlist problem



PureBytes Links

Trading Reference Links

On your optimize statements you don't have to change back and forth 
between param and optimize statements. As I wrote the code the output 
of the param sets the input to the optimize. 

It would be good to develop a system to buy and short whether you use 
it or not. you can continue to back test periodically and see if the 
short side does better compared to the long side. In bear markets it 
often does. In a bull market the long side usually does twice the 
short side. The short side may dominate now. IT is worth a look 
anyway. If you see the indices doing better short then you can play 
inverse ETFs for the down side, especially the 200% inverse ones like 
QID and QLD, UWM and TWM, etc.

The back test results are with 8 and 13. I don't believe the BT 
results. Those that optimize them, curve fit, for best results will 
not achieve those gains in the real world. Most of my real time 
systems don't come close to the BT results. My system trades intra-
bar and back test do not show that. So the back tests are very 
misleading. Sideways markets can kill a system. The only way I know 
of to get the back test results to approach the real world is to 
trade at the end of the bar, actually the open of the next bar if the 
last bar gave a signal. 

I do use back test results but only to find out which method out 
performs another but as far as using it to determine how much gain to 
expect, forget it.

In my opinion the best way to test a system is to collect very short 
time frame data, tick, 5 second or minute and play that back into 
your formula using BarReplay and see what it does. Intra bar action 
is a real eye opener. 

Barry

--- In amibroker@xxxxxxxxxxxxxxx, "Paul Radge" <paulradge@xxx> wrote:
>
> Hi Barry,
>               Many thanks for your reply,
> 
>  I'm very interested in the results you've returned with the code 
running on a hourly chart via futures contracts.
>         I wonder if you optimized the ma's or if those huge returns 
are with the 8 by 13 ? .I would be extremely happy with returns that 
you've mentioned or even part there of.
>        From what i've read in the forum you write/design code to 
link up with IB similar to what Graham does for 
indicators/explorations, maybe i can contact you off the forum to 
speak of setting up a Bot system.I have no IB account at this stage 
but would be very happy to head in that direction with your 
assistance.
> 
> re MA(C,MA1length); and MA(C,MA2length); yes thats how i've set up 
to optimize the ma's by removing the MA(C,r);/ MA(C,t);//and copying 
it behind the ma1length/ma2length while optimizing and then reversing 
that back when i know what the fast/slow values were and assigning 
them to r and t.
> 
>  I didn't set up to short as my intention initially was to try 
build an EOD system on equity's.
> re walkforward and in sample testing,,,my intention there was to 
back test 6 months and then trade it forward for a month after a post 
i read here in the forum and do some experimenting with that also.
> 
>  i'm encouraged and amazed by what you've seen on the return 
figures i have been contemplating going to IB soon as to attempt some 
intraday work and view system draw downs etc. i wonder if we can 
discuss generating a bot system for me please with IB (?),
> 
> (i realise this would not happen overnight as i know very little 
about IB itself)
> kind regards
> Paul
> paulradge@xxx
> 
> 
>   ----- Original Message ----- 
>   From: Barry Scarborough 
>   To: amibroker@xxxxxxxxxxxxxxx 
>   Sent: Monday, October 13, 2008 2:47 AM
>   Subject: [amibroker] Re: backtesting a watchlist problem
> 
> 
>   Some parts of the formula don't make sense. I rewrote the formula 
and 
>   it is blow and made comments on some lines. For some reason using 
>   positionsize causes the back test to fail but then I was running 
it 
>   on TFZ8, R200 futures contract. And I don't try to set back test 
>   parameters in my code. Anyway the BT ran hourly gave a 430% / 
year on 
>   this contracts. But don't believe everything a BT tells you and 
you 
>   will be far ahead of the game. 
> 
>   To run back test on a watchlist config the Auto Analysis window 
Apply 
>   to, to the watch list you want and run back test. Then set the 
Range 
>   from and to to some period. Don't use all quotations. You want to 
>   develop your system and test it on various periods to see how it 
>   works in different sample sets. I ran this on a WL with the DOW 
30. 
>   The BT results will be added to the report. 
> 
>   Barry
> 
>   Updated formula:
>   pFast = Param("Fast MA", 8, 1, 20, 1);
>   pSlow = Param("Slow MA", 13, 1, 50, 1);
> 
>   pFast = Optimize("Fast MA", pFast, 2, 50, 1);
>   pSlow = Optimize("Slow MA", pSlow, 1, 50, 1);
> 
>   fma = MA(C, pFast ); //MA(C,MA1length); ## I don't know what this 
is 
>   but I expect you want to optimize the MAs in this formula
>   sma = MA(C, pSlow ); //MA(C,MA2length); ## ditto
> 
>   PositionScore = RSI(15); 
> 
>   MAup = Cross(FMA, SMA) AND C > 0.1;
>   MAdn = Cross(SMA, FMA) AND C > 0.1; 
> 
>   // buy if condition true on last bar close
>   Buy = Cover = Ref(MAup, -1) ; 
>   BuyPrice=Open;
> 
>   // sell if condition true on last bar close
>   Sell = Short = Ref(MAdn, -1);
>   SellPrice = Open; // since you are examining the last bar you 
want to 
>   trade on the next open not the next close
> 
>   SetTradeDelays(0,0,0,0);
>   // PositionSize=50000; // for some reason when I use this the 
back 
>   test fails
> 
>   Plot(Close, "Price", colorBlack, styleBar);
>   Plot(fma, "Fast MA(" + NumToStr(pFast, 1.0) + ")", colorBlue, 
>   styleLine);
>   Plot(sma, "Slow MA(" + NumToStr(pSlow, 1.0) + ")", 
>   colorRed,styleLine);
> 
>   PlotShapes(shapeUpArrow * Buy,colorBrightGreen);//
>   PlotShapes(shapeDownArrow * Sell,colorRed);
> 
>   Filter = Buy OR Sell; 
>   AddColumn(V,"volume");
>   AddColumn(RSI(15),"rsi");
> 
>   --- In amibroker@xxxxxxxxxxxxxxx, "Paul Radge" <paulradge@> wrote:
>   >
>   > Hi ,
>   > Looking for some help again please ,
>   > re the code below and explorations/backtest reports,
>   > r=8;
>   > 
>   > t=13;
>   > 
>   > Plot(Close, "Price", colorBlack, styleBar);
>   > 
>   > Plot(MA(Close,r),"r-MA",colorBlue,styleLine);
>   > 
>   > Plot(MA(Close,t),"t-MA",colorRed,styleLine);
>   > 
>   > 
>   > 
>   > MA1length=Optimize("ma1length",3,2,50,1);
>   > 
>   > MA2length=Optimize("MA2length",20,50,100,2);
>   > 
>   > fma=MA(C,r);//MA(C,MA1length);////
>   > 
>   > sma=MA(C,t);//MA(C,MA2length);////
>   > 
>   > PositionScore=RSI(15);
>   > 
>   > Filter=Cross(FMA,SMA) AND C>.1 ;
>   > 
>   > 
>   > 
>   > Buy=Ref(Filter,-1);
>   > 
>   > BuyPrice=Open;
>   > 
>   > Sell=Buy;
>   > 
>   > SellPrice=Close;
>   > 
>   > SetTradeDelays(0,0,0,0);
>   > 
>   > PositionSize=5000;
>   > 
>   > PlotShapes(shapeUpArrow*Buy,colorBrightGreen);//
>   > 
>   > PlotShapes(shapeDownArrow*Sell,colorRed);
>   > 
>   > 
>   > 
>   > AddColumn(V,"volume");
>   > 
>   > AddColumn(RSI(15),"rsi");
>   > 
>   > 
>   > 
>   > I'm finding that if i explore a particular date ie 6/10/2008 
and 
>   then backtest on the 7/10/2008 i'm not always backtesting the 
same 
>   stock that was found the day before,i say not always as sometimes 
the 
>   backtest is correct but not 100% of the time.This worries me 
because 
>   when i optimize the system i may be getting a false report.
>   > 
>   > Within AA i'm using the function "use filter" and 
>   selecting "define" ,,market=asx,,group=equity's.
>   > 
>   > Also ,sometimes the stock that is backtested is not even in the 
>   exploration results list from the day before,,,,,,,,,,puzzled 
again.
>   > 
>   > 
>   > 
>   > I've also tried scanning the entire asx for stocks with a close 
>   above 0.1 and created a new watchlist and then defined that 
watchlist 
>   via AA with similar problems,,,
>   > 
>   > 
>   > 
>   > Wondering if anyone can see an error in the code (?) or do you 
>   think i've got a watchlist population problem or maybe i need to 
>   include a "get watchlist" in the code,,i have tried looking 
through 
>   the help file on get watchlist but i'm getting a little lost 
there.
>   > 
>   > 
>   > 
>   > Any advise would be appreciated as i'm concerned any 
optimization 
>   or backtest may include some errors and i need to be confident 
i've 
>   got a true report of the system
>   > 
>   > regards
>   > 
>   > Paul
>   >
>



------------------------------------

**** IMPORTANT ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

*********************
TO GET TECHNICAL SUPPORT from AmiBroker please send an e-mail directly to 
SUPPORT {at} amibroker.com
*********************

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

For other support material please check also:
http://www.amibroker.com/support.html

*********************************
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> 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/