Hi all
I am getting some anomalous results on a particular data set when using the
following
simple rotational system. Is it possible I am looking into the future without
knowing it?
// 3-EMA rotational system
// set up rotational trading
SetTradeDelays( 1,1,1,1 );
EnableRotationalTrading();
positions = Param("# of Positions", 10, 1, 100, 1);
SetOption("WorstRankHeld", positions+1);
PositionSize = -(100/positions); // invest X% of equity in single security
// minimum price
MinPrice = 0.50;
// position scoring
ShortPeriod = Optimize( "Short EMA", 5, 2, 20, 2 );
MediumPeriod = Optimize( "Med EMA", 40, 20, 100, 10 );
LongPeriod = Optimize( "Long EMA", 200, 100, 500, 20);
m1 = EMA(C, Shortperiod);
m2 = EMA(C, mediumPeriod);
m3 = EMA(C, Longperiod);
// slopes
s1 = (m1-Ref(m1, -1))/m1;
s2 = (m2-Ref(m2, -1))/m2;
s3 = (m3-Ref(m3, -1))/m3;
// weights
w1 = -1; //Optimize( "w1", -1, -1, 1, 0.5 );
w2 = 0.5; //Optimize( "w2", 0.5, -1, 1, 0.5 );
w3 = -1; //Optimize( "w3", -1, -1, 1, 0.5 );
PositionScore = IIf( C > minprice, s1*w1 + s2*w2 + s3*w3, 0 );