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

[amibroker] Re: historic random odds



PureBytes Links

Trading Reference Links

Try this. It is an exploration that will use a portfolio of major exchange listed stocks filtered for volume and liquidity. Then it randomly selects stocks from the database and calculates the 1 day ROC. You can adjust the ROC to whatever period you want. Then just take the report into excel, count the up days, and average them. That should work for you, unless you can make it where AB will keep the count and average them for you. I'm not that good at .afl, but it would be neat to see how it is done.

MA20 = MA(C, 20);
AvgVol = MA(V, 20);
DolVol = MA20*AvgVol;
Cond1 = AvgVol > 100000 AND DolVol > 1000000;

RandomNum = mtRandom(); 
/* Adjust the number following RandomNum to decide what percentage is randomly selected*/
Filter = GroupID(0) == 1 AND Cond1 AND RandomNum>0.88; 
AddColumn( ROC(C, 1), "ROC");
AddColumn(DolVol, "DolVol");

--- In amibroker@xxxxxxxxxxxxxxx, "MD" <Dimension0@xxx> wrote:
>
> Hi,
> i am trying to do something that i think is rather simple, but having a heck of a time doing so in Amibroker.  Basically i want to figure out the historic percentage of the market closing 1 OR 2 days after any given day. the code is below:
> 
> FixedDollarAmount = 1000;
> SetBacktestMode( backtestRegularRawMulti ); 
> buy = c; 
> sell = c > valuewhen(buy, c);
> applystop(stoptypeNBar, stopmodeBars, 2);
> PositionSize = FixedDollarAmount;
> 
> The system should buy EVERY day, and sell the next day if it's a higher close or always exit on the 2nd day.
> 
> I want this to run as a backtest so i can see the percentage of win vs loss.  The problem is, it runs fine, but the percentages are way off when tested against Yahoo's data from 1/1/1999 to current day.  I know the historic odds of a close 1 or 2 days later is around 68%, however my backtest is returning 51%.
> 
> Can anyone tell me see any issues with my script or what may be going on here?
> initially i thought the system may be running out of cash, as it uses the default 100,000.  But that does not seem to be the case.
> 
> thank you.
>




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

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

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

TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)

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

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/