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

[amibroker] Backtesting a ranking system


  • Date: Thu, 18 Mar 2010 09:21:40 -0000
  • From: "googool123123" <bfallahi@xxxxxxxxx>
  • Subject: [amibroker] Backtesting a ranking system

PureBytes Links

Trading Reference Links

Hi,

I would like to write a simple backtest that would rank a watchlist
based on a certain criteria and buys any neww addition at the end of the
month and sells any one that goes out of previous top 5, can someone
please help me to the right direction? Thanks

something like this pseudo code assuming RSI is used for ranking

maxPositions = 5
minPositions = 5

stockArray = rankRSI(watchList)
rankArray = sort(stockArray)

if( now is endOfMonth)
{
      for i = rankArray[0] to rankArray[4]
      {
          if(rankArray[i] not in openPositionsArray
          {
               buy rankArray[i]
               openPositionsArray.add(rankArray[i])
           }
       }


         for i = openPositionsArray[openPositionsArray.length] to
openPositionsArray[0]
         {
              if(openPositionsArray[i] is not in rankArray[0] to
rankArray[4]
             {
                  sell(openPositionsArray)
                  openPositionsArray.remove[openPositionsArray[i])
             }
          }
}






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

**** 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:
    amibroker-digest@xxxxxxxxxxxxxxx 
    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/