我想实现一个 afl 代码来查找日内交易中的每日亏损限制。我将使用代码进行大约 200 天的回测。我有以下代码,但有错误。
// identify new day
dn = DateNum();
newDay = dn != Ref( dn,-1);
// Daily Loss Limit
dll = Optimize("dll", 0, 5, 10000, 5 );
EquityCount = 10000;
for( i = 0; i < BarCount; i++ )
{
// signals
Buy = ....;
Sell = ....;
diff = (Equity(1) - Ref(Equity(1), -1));
EquityCount = EquityCount + diff;
// allow only dll
Buy = Buy AND EquityCount > dll;
}
任何帮助将不胜感激。谢谢。