PureBytes Links
Trading Reference Links
|
Hello,
I am new at Rotational Trading and have been having problems for some
time. Ever time I run a Rotational trade and use scoreNoRotate to
keep a symbol during the buy or sell period, the BackTest provides
the wrong results. I get the correct results with an Exploration,
which confirms (for me) that there is no error in the code. So, I
still believe there is an error in AmiBroker.
The following example documents the problem.
In the afl that follows (see below under ********), please note that
the afl does the following.
For all but the first issue, set the PositionScore to effectively
Buy on 10/28/02
Sell on 12/10/02
Buy on 03/28/03
For the first issue
ScoreNoRotate from 12/01/02 to 12/20/02
SO - what you would expect is for the first issue to sell on 12/20,
and all others to sell on 12/10
WHAT HAPPENS IS THAT THEY ALL SELL ON 12/20
THE PROBLEM SEEMS TO BE RELATED TO HAVING A SCORENOROTATE - IT
AFFECTS THE SALE OF THE OTHER ISSUES
Explore will show the PositionScore dates
Backtest will show the trade dates.
Now for the afl
*********************************************
// Run this test on a watchlist of any 4 issues with a start Date <
10/18/02
// Setup all trading options to insure proper execution
MaxPos = 4;
EnableRotationalTrading();
SetFormulaName("Problem Test Run");
BuyPrice = SellPrice = ShortPrice = CoverPrice = Close;
Delay = 0;
SetTradeDelays(Delay, Delay, Delay, Delay);
SetOption( "InitialEquity", 100000 );
SetOption( "AllowSameBarExit", True );
SetOption( "ActivateStopsImmediately", False );
SetOption( "AllowPositionShrinking", True );
SetOption( "FuturesMode", False );
SetOption( "InterestRate", 0 );
SetOption( "MaxOpenPositions", MaxPos );
SetOption( "WorstRankHeld", 4 );
SetOption( "MinShares", .0001 );
SetOption( "PriceBoundChecking", True );
SetOption( "CommissionMode", 2 );
SetOption( "CommissionAmount", 0 );
SetOption( "MarginRequirement", 100 );
SetOption( "ReverseSignalForcesExit", True );
SetOption( "UsePrevBarEquityForPosSizing", False );
PositionSize = -100/MaxPos;
RoundLotSize = 0;
// For all but the first issue, set the PositionScore to effectively
// Buy on 10/28/02
// Sell on 12/10/02
// Buy on 03/28/03
// For the first issue
// ScoreNoRotate from 12/01/02 to 12/20/02
// SO - what you would expect is for the first issue to sell on 12/20,
// and all others to sell on 12/10
// WHAT HAPPENS IS THAT THEY ALL SELL ON 12/20
// THE PROBLEM SEEMS TO BE RELATED TO HAVING A SCORENOROTATE - IT
// AFFECTS THE SALE OF THE OTHER ISSUES
// Explore will show the PositionScore dates
// Backtest will show the trade dates.
PositionScore = 0;
// Set PositionScore = 1 starting 10/28/02 and to but not including
12/10/02; 0 else
PositionScore = IIf(DateNum() >= 1021028 AND DateNum() < 1021210, 1,
PositionScore);
// Set PositionScore = 0 starting 12/10/02 and to but not including
03/28/03; PositionScore else
PositionScore = IIf(DateNum() >= 1021210 AND DateNum() < 1030328, 0,
PositionScore);
// Set PositionScore = 1 starting on 03/28/03; else PositionScore
PositionScore = IIf(DateNum() >= 1030328, 1, PositionScore);
// Set PositionScore to scoreNoRotate starting 12/01/02 and to but
not including 12/20/02; else PositionScore
if (Status("stocknum") == 0)
{
PositionScore = IIf(DateNum() >= 1021201 AND DateNum() <
1021220, scoreNoRotate, PositionScore);
}
Filter = DateNum() >= 1021025 AND DateNum() <= 1030401;
Filter = Filter AND (PositionScore != Ref(PositionScore, -1));
AddColumn(PositionScore, "PS", 4.0);
//
------------------------ Yahoo! Groups Sponsor --------------------~-->
$9.95 domain names from Yahoo!. Register anything.
http://us.click.yahoo.com/J8kdrA/y20IAA/yQLSAA/GHeqlB/TM
--------------------------------------------------------------------~->
Check AmiBroker web page at:
http://www.amibroker.com/
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:
http://docs.yahoo.com/info/terms/
|