I don't know the author of this stuff.

BR

|//Zigzag Validation
/*It is possible to use zigzag in a backtest. the important thing is
that the signals can only occur after the price has passed the
reversal level
*/

p = Peak(*C*,10);
pb = PeakBars(*C*,10) ;
t = Trough(*C*,10) ;
tb = TroughBars(*C*, 10);
_TRACE("p = "+p+" pb = "+pb+" t = "+t+" tb = "+tb);
cp = Cross(p*0.9, LowestSince( pb==0, *C* ));
ct = Cross(HighestSince( tb==0, *C* ), t*1.1);

Fall = Flip(Cp,Ct);
Rise = Flip(Ct,Cp);
_TRACE("fall = "+fall+" rise = "+rise);
*Buy* = *Cover* = Cross(MACD() ,Signal() ) *AND* rise;
*Sell* = *Short* = Cross(Signal( ),MACD()) ;

SetChartOptions( 0, *chartShowDates*| *chartWrapTitle* );
*GraphXSpace*= 10;
_N(*Title* = "{{NAME}} - {{INTERVAL}} {{DATE}} "+_DEFAULT_NAME( )+" :
{{OHLCX}} {{VALUES}}" );

BarColor = IIf( rise, *colorPaleGreen*, IIf( fall, *colorOrange*,
ParamColor( "Price Colour", *colorWhite* )));

Plot( *C*, "", BarColor, ParamStyle( "Price Style", *styleBar*, *maskPrice* ) );

Plot( Zig(*C*,0.1), "Zig", *colorRed*, *styleLine* );
Plot( IIf(pb<tb,Peak( *C*,10)*0.9, Trough(*C*, 10)*1.1), "Zig",
IIf(pb<tb,*colorOrange*,*colorPaleGreen*), *styleStaircase* );

PlotShapes( *shapeSmallUpTriangle**Ct, *colorPaleGreen*, 0, *L*, -12 );
PlotShapes( *shapeSmallDownTriangle**Cp, *colorOrange*, 0, *H*, -12 );

PlotShapes( *shapeUpArrow** *Buy*, *colorGreen*, 0, *L*, -24 );
PlotShapes( *shapeDownArrow** *Sell*, *colorRed*, 0, *H*, -24 );|



Le 13/04/2010 06:12, Tony M a écrit :
Thanks for the reply. I am backtesting a system that uses Zig function. The backtest result is good, but I suspect Zig function may artificially increase the profit. I want to use Explore to generate signal day by day and compare with the backtest result, is this a good method to find whether the system is profitable? It is very time consuming to use Explore to generate signal day by day and than compute the result. Any quick method to test if the system is profitable in real trading? Thanks.

------------------------------------------------------------------------
*From:* reefbreak_sd <[email protected]>
*To:* [email protected]
*Sent:* Mon, April 12, 2010 7:57:12 PM
*Subject:* [amibroker] Re: Can Zig function be used in a system?

One additional use for Zig is to see if a security has large enough price swings to trade profitably.

Some low volatility securities become unprofitable to trade if you factor in commissions and bid/ask slippage.

ReefBreak

--- In amibro...@yahoogrou ps.com <mailto:amibroker%40yahoogroups.com>, "Chris DePuy" <cde...@...> wrote:
>
> The way I have seen it explained is you would use zig to determine what "perfect" performance would be. Then compare it to your system that you are testing that does not use zig. The timeframes used in zig should be similar to those in your other system.
>
>
>
> ----- Original Message -----
> From: Tony M
> To: amibro...@yahoogrou ps.com <mailto:amibroker%40yahoogroups.com>
> Sent: Monday, April 12, 2010 6:09 PM
> Subject: [amibroker] Can Zig function be used in a system?
>
>
>
>
> I am new to Amibroker and I read from the Amibroker UserGuide that the Zig function may looking into the future. Does this mean the Zig function can not be used for any trading system? And how do I know if the Zig function is skewing the backtesting result?
> Thanks,
> Tony
>




Reply via email to