Hi Angio,

I know what you are talking about, but I suspect your request is not clear 
enough for people reading it for the first time.

Correct me if I'm wrong, but when you say "auto-optimizes in real time mode" 
you mean ................  to reoptimize a system after the end of 1 bar (or, 
in a more general way, after the end of X bars... and bars can be both intraday 
or daily) in order to see which values of parameters "kappa1" and "kappa2" 
would have produced the max profit factor in the last 100 days (that is, a lot 
of bars if you are using a 5 minute system) and use them for the following bar 
of trading only. 
At the end of the following bar, the whole procedure is repeated and 2 new 
values for "kappa1" and "kappa2" will be chosen. 

This is very easy to do after every day of trading, but in the "back test mode" 
is completely another matter.

Greetings,

Angelo.







> --- In [email protected], "Angio" <angio1967@> wrote:
> >
> > I would add in this formula a sliding window that auto-optimizes in 
> > real-time mode the values of kappa1 and kappa2 in according to the best 
> > ProfitFactor of previous 100 days. In practice ... an automatic Walk 
> > Foreward .
> > 
> > Invest = 100000;
> > SetOption( "InitialEquity",Invest);
> > SetOption( "MaxOpenPositions",1); 
> > PositionSize=Invest;   
> > ApplyStop(0,0,0,0);
> > ApplyStop(1,0,0,0);
> > ApplyStop(2,0,0,0);
> > SetTradeDelays(0,0,0,0);
> > SetBarsRequired( 10000, 10000); 
> > 
> > TimeFrameSet(in5Minute);
> > 
> > Timeopen=TimeNum()==090000;
> > Timeclose=TimeNum()==173000 ;
> > Time1630=TimeNum()==163000 ;
> > 
> > O_OGGI=ValueWhen(Timeopen,O,1);
> > C_OGGI=ValueWhen(Timeclose,C,1);
> > T_1630=ValueWhen(Time1630,C,1);
> > 
> > Yield1=((T_1630/O_OGGI)-1)*100;
> > alpha=0.02;
> > 
> > for( i = 100; i < BarCount; i++ )
> > {
> > avrg1[0]=yield1[0];
> > avrg1[i]=(1-alpha)*avrg1[i-1]+alpha*yield1[i];
> > dvst1[0]=yield1[0];
> > dvst1[i]=sqrt((1-alpha)*dvst1[i-1]^2+alpha*(yield1[i]-avrg1[i])^2);
> > }
> > 
> > Input1=IIf((Yield1>2*dvst1),1,IIf((Yield1<-2*dvst1),-1,(Yield1/(2*dvst1))));
> > 
> > kappa1=Optimize("kappa1", 0.45, 0, 1, 0.05);
> > kappa2=Optimize("kappa2", -0.95, -1, 0, 0.05 );
> > 
> > Buy=Time1630 AND Input1 >= kappa1;
> > Sell=Timeopen;
> > Short=Time1630 AND Input1 <= kappa2;
> > Cover=Timeclose;
> > 
> > BuyPrice=C;
> > SellPrice=O;
> > ShortPrice=C;
> > CoverPrice=C;
> > 
> > Buy=ExRem(Buy,Sell);
> > Sell=ExRem(Sell,Buy);
> > Short=ExRem(Short,Cover);
> > Cover=ExRem(Cover,Short);
> > 
> > PlotShapes( shapeUpArrow* Buy , colorBlue ,0,L);
> > PlotShapes( shapeHollowUpArrow* Cover ,colorBlue ,0,L);
> > PlotShapes( shapeHollowDownArrow* Sell,colorRed ,0,H);
> > PlotShapes( shapeDownArrow* Short, colorRed ,0, H); 
> > 
> > Plot(C,"",colorBlack,styleCandle);
> > _N(Title = StrFormat("{{NAME}} - ANG Last_H System - {{INTERVAL}} {{DATE}} 
> > - Open %g, Hi %g, Lo %g, Close %g (%.1f%%) Vol " +WriteVal( V, 1.0 ) +" 
> > {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
> > 
> > eq=Param("equity",1,0,1,1);
> > equi=IIf(eq==0,Null,Equity( ));
> > Cover1=Flip(Cover,Short);
> > Short1=Flip(Short,Cover);
> > Buy1=Flip(Buy,Sell);
> > Sell1=Flip(Sell,Buy);
> > Plot( 
> > Equi-Invest,"\n\Equity",IIf(Buy1,colorPaleTurquoise,IIf(Short1,colorRose,colorLightGrey)),
> >  styleArea+styleLeftAxisScale);
> > dr = Equi- Highest(Equi);
> > Plot(dr, "Drawdown", colorDarkRed, styleArea+styleLeftAxisScale );
> > Maxdr=LLV(dr,100000);
> > Plot( Maxdr , "Max Drawdown", colorDarkRed, styleLine+styleLeftAxisScale ); 
> > 
> > 
> > which is the way ? 
> > 
> > UseCustomBacktestProc ?
> > 
> > 
> > thanks for any reply
> > 
> > Angio
> >
>


Reply via email to