Forum Replies Created
-
AuthorPosts
-
TrentRothallParticipant
This code is talked about in detail in the webinar mentioned above.
It adds the stats for Buy and Hold to the Portfolio equity chart in the backtest report.
The below code needs to be saved in the ‘Report charts’ folder in the Amibroker Formulas folder
Code://===================================================================================
// Custom Portfolio equity chart
//===================================================================================
Compounding = True;
SetChartOptions(1, chartShowDates|chartLogarithmic);//whiteBackground = GetChartBkColor() == 1677272;
//Highlightcolour = IIf(whiteBackground, colorBlack, colorWhite);FinalEquity = C;
PlotColour = ColorBlend(colorPaleGreen, colorBlack);
SetGradientFill(colorLightOrange, colorPaleGreen);IndexBuyHold = StaticVarGet(“~HCBTIndexBuyandHold”);
IndexTicker = StaticVarGet(“IndexTicker”);Title = “Equity = $” + NumToStr(FinalEquity, 1.0);
Plot( FinalEquity, “Portfolio Equity”, PlotColour, styleGradient | styleLine, Null, Null, 0, -1 );
if( LastValue(IndexBuyHold) != 0)
{
Plot(IndexBuyHold, “Index”, colorBlack, styleThick);
Title = ” Benchmark ” + IndexTicker + ” = $” +NumToStr(IndexBuyHold, 1.0);
}The below code then needs to be added to your system file, once a backtest is ran it will generate the custom ticker to get plotted on the chart
Code://=====================================================================
// CBT EQUITY CHART
//=====================================================================
IndexTicker = “$XAOA.au”;
StaticVarSetText(“IndexTicker”, IndexTicker);SetOption(“UseCustomBacktestProc”, True);
SetCustomBacktestProc(“”);//====================================================================
if ( Status( “action” ) == actionPortfolio )
{
bo = GetBacktesterObject();
bo.Backtest();IndexBuyHold = 0;
IndexBuyHold[0] = bo.InitialEquity;SetForeign(IndexTicker);
IndexDailyChange = C/Ref(C, -1);
RestorePriceArrays();for(i = 1; i < BarCount; i++) { IndexBuyHold[i] = IndexBuyHold[i-1] * IndexDailyChange[i]; } StaticVarSet("~HCBTIndexBuyandHold", IndexBuyHold); }
Note that the custom chart is in Log scale
TrentRothallParticipantRecommend watching the video too it was great. I noticed Craig’s name too Glen.
Your issue is the +- it should read
Title = “…..
not
Title +- “….TrentRothallParticipantUK for me
TrentRothallParticipantAny word which one?
TrentRothallParticipantThanks guys,
Short term memory here. I did watch the webinar the other day by Nick!
Will see how this plays out.
TrentRothallParticipantCan someone explain why the market is going up? Especially in the US? All the officials/ experts even pump up Trump has been saying the next fortnight will be one of the toughest in modern history yet it rallies 7%… Strange
TrentRothallParticipantSorry on the line –
Sell[j] = True
add
Sell[j] = True * 5
for example
TrentRothallParticipantHi Scott
A hot tip for fault finding or code checking multiple exits is in the looping you can add a identifier so it shows up in the backtest trade report what exit was used.
Some numbers are reserved for certain exits. 5 = n-bar
See this link for more info
https://www.amibroker.com/kb/2014/09/24/how-to-identify-which-signal-triggers/TrentRothallParticipantMarch
ASX MR = -7.22%
total DD since Nov = 19.97%
TrentRothallParticipantanyone using any inverse etfs to hedge or trade? IB won’t let me in BBOZ
TrentRothallParticipantTrent Rothall wrote:on a positive, my Tesla FOMO has quickly evaporated. Interesting level here, short term bounce up to 500ish then retest the $370 is my guessgot the little bounce (although went a bit lower first) now for a big push below support/200ma. Wonder if the 2018 low at $180 will get reached :ohmy:
I see Elon’s trying to prop it up with some positive tweets
TrentRothallParticipantIt was holding over the weekend that freaked me out too. I think NYC announced around 2000 new cases earlier which doubled their total
TrentRothallParticipantWhat systems do you have running Scott?
TrentRothallParticipantthanks Scott, I’ll check it out
TrentRothallParticipantThe thing that hurt my systm was the sudden hard sell off without much of a bounce, my exit is a close above a MA. The distance from the close to the MA was too far once the stock sold off hard fpr 2 or 3 days.
When the indexfilter comes on my entry criteria gets stricter currently but i tested when the filter is on a C > ref(C, -1) to exit. initial testing looks good!
-
AuthorPosts