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

[amibroker] Scanning specific watchlists



PureBytes Links

Trading Reference Links




I only 
had a few minutes to look at your code, but is it possible that you have set 
your preferences such that you will only trade 100 shares?   Then, you 
may not have enough available cash to buy some stocks.   So, it 
skips those stocks until it finds one or more that it can buy at least 100 
shares.
<FONT face=Arial color=#0000ff 
size=2> 
Sound 
possible?
<BLOCKQUOTE 
>
  <FONT face="Times New Roman" 
  size=2>-----Original Message-----From: Keith Osborne 
  [mailto:traderkeith2000@xxxxxxxxxxxx]Sent: Wednesday, January 07, 
  2004 12:56 AMTo: amibroker@xxxxxxxxxxxxxxxSubject: 
  [amibroker] Portfolio Backtester & Watchlist - Help 
  required
  
  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 ; <FONT color=#008000 
  size=1>// Multiple of ATR for position sizing calcs //<FONT 
  size=1>
  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 
  //
  // SYSTEM AREA //
  trailstopamount = <FONT 
  color=#ff00ff size=1>2*<FONT color=#0000ff 
  size=1>ATR(<FONT color=#ff00ff 
  size=1>10); // The stop 
  used is a trailing stop defined as a multiple of ATR(10) //<FONT 
  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@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 
  
  
  Yahoo! Groups Links
  
    To visit your group on the web, go to:<A 
    href="">http://groups.yahoo.com/group/amibroker/  

    To unsubscribe from this group, send an email to:<A 
    href="">amibroker-unsubscribe@xxxxxxxxxxxxxxx  

    Your use of Yahoo! Groups is subject to the <A 
    href="">Yahoo! Terms of Service. 
  


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.