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

[amibroker] EnableRotationalTrading issue



PureBytes Links

Trading Reference Links

I've always been quite sceptic about EnableRotationalTrading() and I've often preferred to go through the more flexible standard backtest mode including my rotational logic within the buy/sell/short/cover conditions.

This time I wanted to give it a try since I wanted to test a quite simple rotational strategy.

The logic is: buy the 2 stocks with the lowest RSI and short the 2 with the highest with a quarterly rebalancing, as simple as that.

Unfortunately the below code doesn't provide the expected quarterly rebalancing even if the ranking is correctly updated quarterly (blue line in the chart).

I believe this is related to the EnableRotationalTrading logic since I had correct results with standard backtest mode when using similar quarterly rebalancing with such ranking variable.

Anyone had similar issues?

----------------------------------------
//Test AB Rotational.afl

SetChartOptions( 0, chartShowArrows );
SetChartOptions( 0, chartShowDates );
SetChartOptions( 2, chartWrapTitle );
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));

Plot( C, Name(), ParamColor( "Color", colorWhite ), ParamStyle( "Style" ) | styleCandle );

SetBacktestMode(backtestRotational); 

MaxOP = Param("Open Positions", 4, 1, 600, 1);

SetOption("SeparateLongShortRank", True );
SetOption("MaxOpenPositions", MaxOP );
SetOption("MaxOpenLong", MaxOP/2 );
SetOption("MaxOpenShort", MaxOP/2 );

SetOption("WorstRankHeld", MaxOP/2); 

Ranking = ValueWhen(Month() != Ref(Month(),1) AND (Month() == 12 OR Month() == 3 OR Month() == 6  OR Month() == 9) , 50-RSI(14));

PositionSize = -(100/MaxOP);

PositionScore = Ranking;

Plot(Ranking, "Ranking", colorLightBlue, styleLine|styleOwnScale);




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

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