Would you mind creating a divergence tool for my TRSI indicator?
thanks
Tony
//Divergence between price and the black/green line.
EMA_RSI = EMA ( RSI(14), 3 ) ;
EMA_RSI2 = EMA ( EMA_RSI, 3 ) ;
EMA_RSI3 = EMA ( EMA_RSI2, 3) ;
Plot( RSI( 14),"", colorBlack, ParamStyle("Style") );
Plot( EMA_RSI3, "", colorGreen, ParamStyle("Style") );
xshift = Param ("Shift", 3,0,50,1,1 );
Plot( MA ( EMA_RSI3,5 ), "", colorRed, ParamStyle ("Style", styleLine), ParamStyle ("Style", styleOwnScale), ParamStyle ("Style", styleThick), xshift );
//
See if this does what the VT codes does:
"Relative Strength Index" ;
//pilpilonim [ [EMAIL PROTECTED]] "...It sure looks good in VT..."
SetChartOptions (1, chartShowDates);
RSIper = Param( "RSI Periods", 5,2 ,50 ,1 );
RSIndex = RSI(RSIper);
//This will detect a trough of RSI, then detect a second trough lower than the first Trough
DefineTrough = RSIndex > Ref(RSIndex,- 1) AND Ref(RSIndex,- 1) < Ref(RSIndex,- 2);
PrevTrough = ValueWhen(DefineTrough, Ref(RSIndex,- 1),2 );
ActualTrough = DefineTrough AND PrevTrough < Ref (RSIndex,-1 );
PrevPrcTrough = ValueWhen(DefineTrough, Ref(L,- 1), 2);
ActualPrcTrough = DefineTrough AND PrevPrcTrough > Ref (L,- 1 );
BullishDivergence = ActualTrough AND ActualPrcTrough;
//This will detect a peak of RSI , then detect a second peak higher than the first peak}
DefinePeak = RSIndex < Ref(RSIndex,- 1) AND Ref(RSIndex,- 1) > Ref(RSIndex,- 2);
PrevPeak = ValueWhen(DefinePeak, Ref(RSIndex,- 1),2 );
ActualPeak = DefinePeak AND PrevPeak > Ref (RSIndex,-1 );
PrevPrcPeak = ValueWhen(DefinePeak, Ref(H,- 1), 2);
ActualPrcPeak = DefinePeak AND PrevPrcPeak < Ref (H,-1 );
BearishDivergence = ActualPeak AND ActualPrcPeak;
Plot( C,Name (),IIf( C > O,colorGreen,colorRed),styleBar | styleThick);
Plot( H,"High" ,colorGrey50);
Plot (L, "Low" ,colorGrey50);
Plot(RSIndex, "RSI(" + NumToStr (RSIper,1.0 ) + ")" ,colorDarkRed,styleOwnScale, 0,100 );
PlotShapes (IIf(BullishDivergence, shapeCircle,shapeNone),colorGreen, 0,L, 0);
PlotShapes( IIf(BearishDivergence,shapeCircle, shapeNone),colorRed,0 ,H,0 );
--
Terry
-----Original Message-----
From: [email protected] [mailto: [email protected]] On Behalf Of pilpilonim
Sent: Monday, April 10, 2006 23:59
To: [email protected]
Subject: [amibroker] Re: Divergence Indicator
It sure looks good in VT.
Anyone please?
--- In [email protected] , "ramot06" <[EMAIL PROTECTED]> wrote:
>
> Hi everyone.
>
> I came acroos some quite productive divergence indicator in VT.
> Could someone take the stick and convert it to AFL?
>
> Thanks In advance.
>
>
> The code :
>
>
> {Relative Strength Index}
>
> RSIndex:= RSI(RSIper);
>
> {This will detect a trough of RSI, then detect a second
> trough lower than the first trough}
>
> DefineTrough:= if(RSIndex>ref(RSIndex,-1) and ref(RSIndex,-1)<ref
> (RSIndex,-2), 1, 0);
>
> PrevTrough:= valuewhen(2,DefineTrough,ref(RSIndex,-1));
> ActualTrough:= if(DefineTrough and PrevTrough<ref(RSIndex,-1),1,0);
>
> PrevPrcTrough:= valuewhen(2,DefineTrough,ref(L,-1));
> ActualPrcTrough:= if(DefineTrough and PrevPrcTrough>ref(L,-1),1,0);
>
> BullishDivergence:= if(ActualTrough=1 and ActualPrcTrough=1,1,0);
>
> {This will detect a peak of RSI, then detect a second
> peak higher than the first peak}
>
> DefinePeak:= if(RSIndex<ref(RSIndex,-1) and ref(RSIndex,-1)>ref
> (RSIndex,-2), 1, 0);
>
> PrevPeak:= valuewhen(2,DefinePeak,ref(RSIndex,-1));
> ActualPeak:= if(DefinePeak and PrevPeak>ref(RSIndex,-1),1,0);
>
> PrevPrcPeak:= valuewhen(2,DefinePeak,ref(H,-1));
> ActualPrcPeak:= if(DefinePeak and PrevPrcPeak<ref(H,-1),1,0);
>
> BearishDivergence:= if(ActualPeak=1 and ActualPrcPeak=1,1,0);
>
Please note that this group is for discussion between users only.
To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com
For other support material please check also:
http://www.amibroker.com/support.html
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/amibroker/
<*> To unsubscribe from this group, send an email to:
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
Please note that this group is for discussion between users only.
To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com
For other support material please check also:
http://www.amibroker.com/support.html
YAHOO! GROUPS LINKS
- Visit your group "amibroker" on the web.
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
Please note that this group is for discussion between users only.
To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com
For other support material please check also:
http://www.amibroker.com/support.html
| Investment management software | Real estate investment software | Investment property software |
| Software support | Real estate investment analysis software | Investment software |
YAHOO! GROUPS LINKS
- Visit your group "amibroker" on the web.
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
