Hi,
Will appreciate help with the correct settings in the Backtester.
I am primarily getting stuck in trying to derive the correct intrabar exit
levels using the backtesting functionality interface.
In the code listed below, a user defined paramater is used for the trailing
Stop. Often the price will hit the trailing Stop Loss level and continue moving
without triggering a exit/reverse signal. I am unable to get these exit levels
correctly when using the backtester interface.
Is there some setting to specify within the Backtesting interface or does this
need some change in the following code ?
Thanks in advance.
Cheers
Amar
no=Param( "Swing", 9, 1, 55 );
tsl_col=ParamColor( "Color", colorCycle );
res=HHV(H,no);
sup=LLV(L,no);
avd=IIf(C>Ref(res,-1),1,IIf(C<Ref(sup,-1),-1,0));
avn=ValueWhen(avd!=0,avd,1);
tsl=IIf(avn==1,sup,res);
Plot(tsl, _DEFAULT_NAME(), tsl_col, styleStaircase);
Buy=Cover=Cross(C,tsl);
Sell=Short=Cross(tsl,C);
shape=Buy*shapeUpArrow + Sell*shapeDownArrow;
PlotShapes(shape,IIf(Buy,tsl_col,tsl_col),0,IIf(Buy,Low,High));
_SECTION_END();
_SECTION_BEGIN("Price");
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g,
Close %g (%.1f%%)
{{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot( C, "Close", ParamColor("Color", colorBlack ), styleNoTitle |
ParamStyle("Style") | GetPriceStyle() );
_SECTION_END();