PureBytes Links
Trading Reference Links
|
Thomas,
I may be completely off the mark here but I think you need to use timeframeexpand to match up the time series with the previous close you referenced.
If you use something like the following the numbers match up. Again, this is just a guess but maybe it will help point you in the right direction to debug the difference. My apologies in advance if its unrelated.
TimeFrameSet( inWeekly); // <---- Add / remove causes hugh difference
Rank1 = Nz(ROC(C, 4));
TimeFrameRestore();
Rank2= TimeFrameExpand(Rank1,inWeekly);
Regards,
Duke Jones, CMT
> -------Original Message-------
> From: tchan95014 <tchan@xxxxxxxxxx>
> Subject: [amibroker] Need help on rotation system
> Sent: 08 Mar '07 00:59
>
> I am experimenting with a very simple rotation system as below.
>
> My goal is to develop it into a weekly only system. I run it once a
> week, it runs on weekly data and does the stock rotation, if
> necessary, on a weekly basis at the most.
>
> I expect the system to generate trades on the same day of the week,
> and not on other weekdays. For example, if I set it to run on weekend,
> any new trades are always executed on Monday (buys and sells) and not
> other weekdays.
>
> It would be best to allow for trade executions on any weekdays, but
> Friday run, Monday execution is good enough.
>
> However, when I started from the simplest one I can get, I got stumped.
>
> With a simple system like this, comparing the results with
> TimeFrameSet( inWeekly ) ON or OFF, I got completely different
> results, as you can see I do not even use any of the OHLC series to
> rank the system.
>
> Also the trades do not seem to be always executed on the same weekday
> at all, even with the settradedealy(), I was not able to explain it.
>
> I then ran the Explore to find the Rank and Rank1 gives completely
> different results when both TimeFrameXXXX are used at the same time.
>
> Ultimately, if someone can provide a framework for a weekly only
> rotation system as I described above, very much appreciated.
>
> Please help...
>
> Thanks
>
> Thomas
>
> //----------------------------------------------------------
> EnableRotationalTrading();
> SetTradeDelays( 1, 1, 1, 1 );
>
> //----------------------------------------------------------
> SetOption("WorstRankHeld", 30);
> SetOption("MaxOpenPositions", 10);
> SetOption("Initialequity", 50000);
> SetOption("MinShares", 1);
> SetOption("CommissionMode", 1); // % per trade
> SetOption("CommissionAmount", 0.5); // 0.5% per trade to
> account for slippage
> SetOption("AllowPositionShrinking", True);
>
> //----------------------------------------------------------
> WeeklyClose = TimeFrameGetPrice("C", inWeekly, -1); // Use only LAST
> week's data to test
>
> Rank = Nz(ROC(WeeklyClose, 4));
>
> TimeFrameSet( inWeekly); // <---- Add / remove causes hugh difference
>
> Rank1 = Nz(ROC(C, 4));
>
> //----------------------------------------------------------
> PositionSize = -10;
> PositionScore = 100 + Rank;
>
> //
> ----------------------------------------------------------
> // Explore
> //
> ----------------------------------------------------------
> Filter = C > 0;
>
> AddColumn(WeeklyClose, "Weekly Close", 1.4, colorBlack);
> AddColumn(Ref(WeeklyClose, -1), "Weekly Close(-1)", 1.4, colorBlack);
> AddColumn(Close, "Close", 1.4, colorBlack);
> AddColumn(Ref(Close, -1), "Close(-1)", 1.4, colorBlack);
> AddColumn(Rank, "Rank", 1.4, IIf(Rank > 0, colorBlack, colorRed));
> AddColumn(Rank1, "Rank1", 1.4, IIf(Rank > 0, colorBlack, colorRed));
>
>
------------------------ Yahoo! Groups Sponsor --------------------~-->
Transfer from your equities account.
Receive up to $1,000 from GFT. Click here to learn more.
http://us.click.yahoo.com/aZttyC/X_xQAA/cosFAA/GHeqlB/TM
--------------------------------------------------------------------~->
Please note that this group is for discussion between users only.
To get 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/
|