Hi Donald,

Here is a simple example that is in the systems folder of the AB Release.

// Simple example of rotational trading system
// This is contrarian strategy - 
// it buys 4 "worst" stocks - the ones that suffered the most in last year
// (4 stocks having worst 252-bar rate-of-change)
// 
// 4 positions
MaxPositions = 5;
SetOption("MaxOpenPositions", MaxPositions  );
SetOption("WorstRankHeld", MaxPositions + 2 );
SetPositionSize( 100 / MaxPositions, spsPercentOfEquity ); 

// trade on next day open
SetTradeDelays( 1, 1, 1, 1 );
BuyPrice = Open;

SetBacktestMode( backtestRotational );

// offsetting by large positive number 
// makes sure that our score is always positive and we don't enter short trade
PositionScore = 10000 - ROC( C, 5 ); 

You can add "clauses" to the positionScore using the following pattern:

PositionScore = 
IIf ( C*V > 10000.    // only return a value if  more than $10k traded     
       10000 - ROC( C, 5 ), // The actual PositionScore
        0); // Get a 0 score if the liquidity requirements are not met


Hope this gets you started.

Z




________________________________
From: donald_brown_48367 <[email protected]>
To: [email protected]
Sent: Mon, 14 December, 2009 5:08:17 AM
Subject: [amibroker] Rotational Trading Code

  
Does anyone have a simple rotational code that they can post?


 


      
__________________________________________________________________________________
Win 1 of 4 Sony home entertainment packs thanks to Yahoo!7.
Enter now: http://au.docs.yahoo.com/homepageset/

Reply via email to