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

[amibroker] Keeping short period shorter than long period in Optimizations?



PureBytes Links

Trading Reference Links

/* Consider optimizing a system with two periods, one shorter than the other.
for example: */
speriod = Optimize("Short Period", 9, 3, 36, 3); // 12 values
lperiod = Optimize("Long Period", 15, 6, 39, 3); // 12 values
if(speriod < lperiod){  // force zero trades when short not less than long
   Buy = Cross(EMA(C, speriod), EMA(C,Lperiod));
   Sell = Cross(EMA(C, Lperiod), EMA(C,speriod));
}
/* If I run an Optimization with the above code, I get 144 tests,
more than 1/2 with no trades. 

I can avoid the zero and redundant trades by instead writing the following:
*/
speriod = Optimize("Short Period", 9, 3, 36, 3); // 12 values
diff = Optimize("Short minus Long", 6, 3, 36, 3); // 12 values
lperiod = speriod + diff;
Buy = Cross(EMA(C, speriod), EMA(C,Lperiod));
Sell = Cross(EMA(C, Lperiod), EMA(C,speriod));
/*  but I still get 144 tests. More than 1/2 (lperiod > 39) I am not interested in.
Anybody know how to write this so just the 60 non-zero, non-redundant tests are performed?
*/


Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com

For other support material please check also:
http://www.amibroker.com/support.html





SPONSORED LINKS
Investment management software Real estate investment software Investment property software
Software support Real estate investment analysis software Investment software


YAHOO! GROUPS LINKS