PureBytes Links
Trading Reference Links
|
Hello,
For the help on detecting divergences please check MACD commentary formula
http://www.amibroker.com/library/detail.php?id=21
In short:
"\nDivergence\n";
temp = Trough(LOW, 2, 1) < 0.96 * Ref( Trough(LOW, 2, 1), -1) AND ValueWhen(
Trough(LOW, 2, 1) != Ref( Trough(LOW, 2, 1), -1 ), MACD(), 1 ) >= 0.90 *
ValueWhen( Trough( LOW, 2, 1) != Ref( Trough( LOW, 2, 1), -1 ), MACD(), 2 ) AND
MACD() < 0;
temp2= Peak( HIGH,2, 1) > 1.04 * Ref( Peak( HIGH, 2, 1), -1) AND ValueWhen(
Peak( HIGH, 2, 1) != Ref( Peak( HIGH, 2, 1), -1 ), MACD(), 1 ) <= 0.90 *
ValueWhen( Peak( HIGH, 2, 1) != Ref( Peak( HIGH, 2, 1), -1 ), MACD(), 2 ) AND
MACD() > 0;
writeif( hhv( temp, 5 ) == 1,"A bullish divergence occurred " + writeval(
barssince( temp ), 1.0 ) +
" period(s) ago. Wait for upward price movement for confirmation before
considering any long positions.",
writeif( hhv( temp2,5) == 1,
"A bearish divergence occurred " +
writeval( barssince( temp2 ), 1.0 ) +
" period(s) ago. Wait for downward price movement for confirmation before
considering any short positions.",
"There have been no divergence signals within the last 5 periods." ) );
Best regards,
Tomasz Janeczko
amibroker.com
----- Original Message -----
From: "nenapacwanfr" <nenapacwanfr@xxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Monday, July 08, 2002 2:31 PM
Subject: [amibroker] Re: divergence in price-indicator (How)
> Hi, dimitri,
>
> perhaps I am "blind" , but the code for trendlines is written with
> lasvalue
>
> pS = troughBars( s1, per, 1 ) == 0;
> endt= lastvalue(ValueWhen( pS, x, 1 ));
> startt=lastvalue(ValueWhen( pS, x, 2 ));
> dtS =endt-startt;
> endS = lastvalue(ValueWhen( pS, s1, 1 ) );
> startS = lastvalue( ValueWhen( pS, s1, 2 ));
> aS = (endS-startS)/dtS;
> bS = endS;
> trendlineS = aS * ( x -endt ) + bS;
>
> > Stephane,
> > Trendlines work for the whole range.
> > [Did you see the recent Hang Seng Index example ?]
> > Simply remove the Lastvalue, whereever it is and that s it.
> > From any trendline equation you can get the slope.
> > A positive divergence is when the slope of support of C is negative
> > and the slope of support of RSI is positive.
> > Then you may explore, scan, optimize and backtest.
> > Dimitris Tsokakis
> > [without & Co ]
> > --- In amibroker@xxxx, "nenapacwanfr" <nenapacwanfr@xxxx> wrote:
> > > hello,
> > >
> > > it is a good subject
> > > dimitri & Co have given various example with trendlines, but it
> > works
> > > only with lastvalue
> > > and we can't backtest it.
> > > of course we can visualize them with the simulator.
> > >
> > > one caveat of divergence is that we know it too late...
> > >
> > > stephane
> > >
> > >
> > >
> > > > How to program in AFL a divergence between the price and and
> > > > indicator such as RSI? Thanks
>
>
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
>
|