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

[amibroker] Re: backtesting a watchlist problem



PureBytes Links

Trading Reference Links

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@xxx> 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/