PureBytes Links
Trading Reference Links
|
<FONT face=Arial
color=#0000ff>The trade list has all the information you need, Right? Have
another look at the tradelist and see the wealth of (afl inaccessible) info it
contains.
<FONT
size=2>I trade portfolios too, and i want to see
how individual stocks perform. The only place to get the stats is from the
tradelist, there is no other way - especially when trading
portfolios.
<FONT face=Arial
color=#0000ff>
<FONT face=Arial
color=#0000ff>In your case you would sort the tradelist by ticker and
then extract the stats for each ticker for more processing. I am getting
tired of explaining the benefits of having access to a tradelist from afl, it
appears so obvious to me. I garantee that this function will be available
eventually, it just has to be in order to do any serious system
analysis.
<FONT face=Arial
color=#0000ff>
<FONT face=Arial
color=#0000ff>Below<FONT
face=Arial color=#0000ff size=2> is a simple String-based function that
extracts trade information from the Tradelist, if you click on a bar that
had a trade it will display the chart for the stock traded on that day else the
pane is blank. If there were more trades on that day you can look at the
different trades by using Param(). You can also use Param() to
extract other isolated stats that will display in the Title. This is just a
test program and illustrates SINGLE stats, to diplays stats over time you need
to place it in a loop <FONT
face=Arial color=#0000ff size=2>but it will be extremely SLOW!!! I suggest you
test it using a short trade list :-)
<FONT face=Arial color=#0000ff
size=2><FONT face=Arial
color=#0000ff size=2>
After
exporting your TradelList to <FONT
color=#ff00ff>"C:\\Program Files\\AmiBroker\\Trades\\TradeList.csv"<FONT
color=#000000>;
<FONT face=Arial
color=#0000ff size=2>Copy the code below to the IB and Apply. Then click on
any bar that has a new trade, since the code only responds when you hit the
first bar of a trade you may have to click a few time to find them, or look for
a date in your tradelist. Just remember that this is experimental and unfinished
code.
<FONT face=Arial color=#0000ff
size=2>
Let me
know if you think this could be the basis for further work.
<FONT face=Arial color=#0000ff
size=2>herman
//
ReadTradeListFunction_N(path="C:\\Program
Files\\AmiBroker\\Trades\\TradeList.csv");global Header;
<FONT face=Arial color=#0000ff
size=2>function EODgetStat( CurrentDate , TradeNum, FieldNum
) { FieldData = ""; if( fh = fopen( Path, "r")
) { i=0;j=0; while( ! feof( fh
)) { if(i++==0) Header = fgets( fh
); S1 = fgets( fh
); DateIn = StrExtract(S1,2); if(
CurrentDate ==
DateIn) { j++; if(
j == TradeNum
) { FieldData=
StrExtract(S1,FieldNum); } } } } else {
printf("ERROR: file can not be found (does not
exist)"); } fclose( fh ); return
FieldData;}
Newday
= IIf(DateNum() != Ref(DateNum(),-1),1,0);DayNum =
Cum(NewDay);n =
SelectedValue(BarIndex());DN = DateTime();DNs
= StrLeft(WriteVal(DN[n],formatDateTime),8);FieldNum =
Param("FieldNum",8,0,20,1);TradeNum =
Param("tradeNum",1,1,10,1);
<FONT face=Arial color=#0000ff
size=2>FieldData = EODgetStat( DNs, TradeNum, FieldNum);Ticker = EODgetStat(
DNs, TradeNum, 0);if(Ticker == "") Q = Null; else Q=1;
SetForeign(Ticker);Plot(Q*C,"",1,64);
if(Q)
Title = DNs+" "+Ticker+" "+StrExtract(Header, FieldNum)+
" "+ EODgetStat( DNs, TradeNum, FieldNum); else
Title="";
<FONT face=Arial color=#0000ff
size=2>
<FONT face=Arial color=#0000ff
size=2>
<FONT face=Arial color=#0000ff
size=2>
<FONT face=Tahoma
size=2>-----Original Message-----From: dingo
[mailto:dingo@xxxxxxxxxxxx]Sent: Tuesday, April 13, 2004 11:14
PMTo: amibroker@xxxxxxxxxxxxxxxSubject: RE: [amibroker]
Coding challenge - SubtotalsImportance: High
<FONT face=Arial
color=#0000ff size=2>Backtesting portfolios of individually timed
stocks. I'd like to have totals by month or quarter or whatever by
stock (per ticker per period) but only run the back test once for say 10
years.
<FONT face=Arial
color=#0000ff size=2>
<FONT face=Arial
color=#0000ff size=2>I don't quite see how your dll could make this a
snap. I'd write it If I knew how, duude.
<FONT face=Arial
color=#0000ff size=2>
<FONT face=Arial
color=#0000ff size=2>d
From: Herman van den Bergen
[mailto:psytek@xxxxxxxx] Sent: Tuesday, April 13, 2004 9:58
PMTo: amibroker@xxxxxxxxxxxxxxxSubject: RE:
[amibroker] Coding challenge - Subtotals
<FONT face=Arial color=#0000ff
size=2>Are you backtesting portfolios?
<FONT face=Arial color=#0000ff
size=2>
<FONT face=Arial color=#0000ff
size=2>Are you basket trading or trading individually timed stocks? <SPAN
class=468033101-14042004>I am not sure
how you want the tickers isolated, it dependends on how you
trade...
<FONT face=Arial color=#0000ff
size=2>
<FONT face=Arial color=#0000ff
size=2>What do you mean by "Ticker period"?
<FONT face=Arial color=#0000ff
size=2>
To
start a trade in progress you can use Buy = Flip(Buy,Sell); instead of a
single-bar Buy signal. Remember to add a delay if you use tradedelays. This
will get you into the trade whenever the Date qualifier becomes true.
<FONT face=Arial color=#0000ff
size=2>
<FONT face=Arial color=#0000ff
size=2>You may be able to exit at the end of a test period by making
Sell = Sell OR (Month() != ref(Month(),-1);
<FONT face=Arial color=#0000ff
size=2>
If
the tradelist has all the info you need you could parse it by date, either
in excel or afl. Looks like that DLL I wanted would have come in very
handy ;-) your analysis would have been a snap.
<SPAN
class=468033101-14042004><FONT face=Arial color=#0000ff
size=2><FONT face=Arial
color=#0000ff size=2><FONT
face=Arial color=#0000ff size=2>
<FONT face=Arial color=#0000ff
size=2>herman
<FONT face=Arial color=#0000ff
size=2> Send BUG REPORTS to
bugs@xxxxxxxxxxxxxSend SUGGESTIONS to
suggest@xxxxxxxxxxxxx-----------------------------------------Post
AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx (Web page: <A
href="">http://groups.yahoo.com/group/amiquote/messages/)--------------------------------------------Check
group FAQ at: <A
href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Yahoo! Groups Links
To visit your group on the web, go to:http://groups.yahoo.com/group/amibroker/
To unsubscribe from this group, send an email to:amibroker-unsubscribe@xxxxxxxxxxxxxxx
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
|