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

[amibroker] Ready to give up on Profit



PureBytes Links

Trading Reference Links





Hi, can anyone help me 
with the following code. It is a simple system I coded to understand how the 
backtester works.
The postion sizing and 
the trailing stop portions work fine but when I run this code against the 
backtester using a watchlist of some 50 stocks then it does not pick up the 5th, 
6th, 8th and 10th stocks in the watchlist and create a long position. 

<SPAN 
class=363443701-07012004>The question I have is "does the backtester evaluate 
each stock in the order of the watchlist", if so why does it miss some stocks 
and pick the next one?
<SPAN 
class=363443701-07012004>TIA....Keith
<SPAN 
class=363443701-07012004> 
<SPAN 
class=363443701-07012004>Code......................
 
Eqty = <FONT color=#ff00ff 
size=1>50000<FONT 
face=Arial>;
Max_Trade = <FONT 
color=#ff00ff size=1>0.1*Eqty; <FONT color=#008000 
size=1>// 10% of Equity per trade //
Max_Risk = <FONT 
color=#ff00ff size=1>0.01*Eqty; <FONT color=#008000 
size=1>// 1% of Equity at risk on each trade //
ATR_risk =<FONT color=#ff00ff 
size=1>2 ; // Multiple of 
ATR for position sizing calcs //
PosSize2 = Max_Risk/(ATR_risk*<FONT 
face=Arial>ATR(<FONT 
color=#ff00ff size=1>10)); <FONT color=#008000 
size=1>// No. of Shares based upon risk and ATR //<FONT 
size=1>
PositionSize = 
IIf<FONT 
size=1>(PosSize2>=Max_trade, Max_trade,possize2); <FONT color=#008000 
size=1>// Positon sizing based upon equity or risk limits //<FONT 
size=1>
// SYSTEM AREA //
trailstopamount = <FONT 
color=#ff00ff size=1>2*<FONT color=#0000ff 
size=1>ATR(10<FONT 
size=1>); // The stop used is a trailing stop 
defined as a multiple of ATR(10) //<FONT 
face=Arial color=#008000 size=1>
// The system is very simple...
Buy = 
C><FONT color=#ff00ff 
size=1>0;
Sell = C<<FONT 
color=#ff00ff size=1>0;<FONT color=#0000ff 
size=1>
ApplyStop<FONT 
size=1>(2,<FONT 
color=#ff00ff size=1>2<FONT 
size=1>,trailstopamount,True,True);<FONT 
face=Arial color=#008000 size=1>
//PositionScore = 100-RSI(); // Prefer stocks that have low 
RSI;
AddColumn<FONT 
size=1>(PositionSize,"Pos 
Size",1.0<FONT 
size=1>);
//AddColumn(PositionScore,"Pos Score",1.2);<FONT color=#0000ff 
size=1>
AddColumn<FONT 
size=1>(posSize2,"POSsize2"<FONT 
size=1>,1.0<FONT 
size=1>);
AddColumn<FONT 
size=1>(ATR(<FONT 
color=#ff00ff size=1>10),<FONT color=#ff00ff 
size=1>"ATR",<FONT color=#ff00ff 
size=1>1.4);
AddColumn<FONT 
size=1>(trailstopamount,"Trail 
Stop",1.4<FONT 
size=1>);
AddColumn<FONT 
size=1>(C,"Price"<FONT 
size=1>,1.2<FONT 
size=1>);


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.