|
大家有寫信去amibroker問過嗎?他們會回答喔!針對這個問題我去信問了,回覆如下:還沒研究,先貼上來
Hello,
Thank you very much for your e-mail. You can create a copy of equity from each backtest run:
http://www.amibroker.com/kb/2006 ... f-portfolio-equity/
If you use different names for the composite tickers you create, then you can use FOREIGN to combine them all:
equityTicker = Foreign("~EquityCopy1", "C")+Foreign("~EquityCopy2", "C")+Foreign("~EquityCopy3", "C");
See:
http://www.amibroker.com/f?foreign
So – you can for example modify the built-in Portfolio-equity formula for that like this:- eq = Foreign("~EquityCopy1", "C")+Foreign("~EquityCopy2", "C")+Foreign("~EquityCopy3", "C");;
- Cash = Foreign("~EquityCopy1", "L")+Foreign("~EquityCopy2", "L")+Foreign("~EquityCopy3", "L");;
- dr = eq - Highest(eq);
- bslh = HighestBars(eq);
- GraphZOrder=1;
- Plot(eq, "Portfolio Equity", colorLightBlue, styleArea );
- if( ParamToggle("Show Cash", "No|Yes", 1 ) ) Plot(cash, "Cash", colorGreen, styleArea );
- if( ParamToggle("Show Drawdown", "No|Yes", 1 ) ) Plot(dr, "Drawdown", colorDarkRed, styleArea );
- if( ParamToggle("Show #bars since last high", "No|Yes", 0 ) ) Plot(bslh, "#bars since last high", colorDarkYellow, styleLine | styleOwnScale, 0, 10 * LastValue( Highest( bslh ) ) );
- islastbar = Status("lastbarintest");
- isfirstbar = Status("firstbarintest");
- bar = BarIndex();
- firstbar = LastValue( ValueWhen( isfirstbar, bar ) );
- lastbar = LastValue( ValueWhen( islastbar, bar ) );
- al = LastValue( ValueWhen( islastbar, LinRegSlope( eq, Lastbar - firstbar + 1 ) ) );
- bl = LastValue( ValueWhen( islastbar, LinRegIntercept( eq, Lastbar - firstbar + 1 ) ) );
- Lr = al * ( BarIndex() - firstbar ) + bl;
- Lr = IIf( bar >= firstbar AND bar <= lastbar , Lr, Null );
- if( ParamToggle("Show lin. reg.", "No|Yes", 0 ) )Plot( Lr , "Linear Reg", colorRed, styleThick );
複製代碼 |
評分
-
查看全部評分
|