[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] Re: Divergence Indicator



PureBytes Links

Trading Reference Links

It sure looks good in VT.
Anyone please?


--- In amibroker@xxxxxxxxxxxxxxx, "ramot06" <ramot06@xxx> 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:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/