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

[amibroker] Re: Tushar chande's Adaptive Stoch - code error



PureBytes Links

Trading Reference Links


Your welcome Rakesh.

Just realised there was an error in the code at this line:

v4 =IIf (v1==v2, 1, IIf (v1=v3,0,IIf((V2 -V3) >

which should read 

v4 =IIf (v1==v2, 1, IIf (v1==v3,0,IIf((V2 -V3) >

That equality operator gets me every time.




--- In amibroker@xxxxxxxxxxxxxxx, Rakesh Sahgal <rakeshsahgal@xxxx> 
wrote:
> Hi MM,
> 
> Thanks a ton.
> 
> 
> Cheers
> 
> R
> --- micmus2002 <micmus2002@xxxx> wrote:
> > 
> > Think this should do it Rakesh,
> > 
> > 
> > StDevPer=Param("Std Dev Period",20,10,30);
> > lenmax= 28; 
> > lenmin=7;
> > currlen=0;
> > stochma=0;
> > v1 = StDev(C,StDevPer) ;
> > v2 = HHV(v1, StDevPer) ;
> > v3 = LLV(v1, StDevPer) ;
> > 
> > 
> > 
> > v4 =IIf (v1==v2,  1, IIf (v1=v3,0,IIf((V2 -V3) >
> > 0,((v1 - v3)/(v2-
> > v3)) ,0)));
> > currlen = int(lenmin + (lenmax-lenmin)*(1-v4));
> > hh = HHV(H, currlen) ;
> > ll = LLV(L, currlen) ;
> > stoch = IIf ((hh-ll) > 0 ,((Close - ll)/(hh - ll)) *
> > 100,0); ;
> > stochma =EMA(Stoch,3);
> > Plot(stoch,"Adaptive
> > Stochastic",colorRed,styleLine);
> > Plot(stochma,"StochK",colorBlue,styleLine);
> > 
> > 
> > Cheers
> > 
> > 
> > MM
> > 
> > --- In amibroker@xxxxxxxxxxxxxxx, Rakesh Sahgal
> > <rakeshsahgal@xxxx> 
> > wrote:
> > > Hi All
> > > 
> > > Following is the link to an article on Adaptive
> > > Stochastic as created by Tushar Chande.
> > > 
> > >
> >
> http://trader.online.pl/ELZ/t-i-Adaptive_Stochastic_Oscillator.html
> > > 
> > > Quite simple excepting for the key bit(isnt it
> > always
> > > that way!).
> > > 
> > >
> >
> =======================================================
> > > 
> > > v1 = stddev(c,20) ;
> > > v2 = highest(v1, 20) ;
> > > v3 = lowest(v1, 20) ;
> > > 
> > > 
> > >  {-- Create v4: stochastic oscillator for 20-day
> > std.
> > > dev. --}
> > > {-- if v1=v2 (highest level) => v4 = 1; if v1=v3
> > > (lowest level) => v4=0 --}
> > > 
> > > if (v2-v3) > 0 then v4 = ((v1 - v3)/(v2-v3)) Else
> > v4 =
> > > 0 ;
> > > 
> > > {-- Calculate current effective length; if v4 = 1,
> > > then length = mininum --}
> > > 
> > > currlen = IntPortion(lenmin +
> > (lenmax-lenmin)*(1-v4))
> > > ;
> > > 
> > >
> >
> ======================================================
> > > 
> > > 
> > > Can some please help out with the coding of this
> > > portion for ascertaining Stoch length?
> > > 
> > > 
> > > TIA
> > > 
> > > 
> > > Rakesh
> > > 
> > > 
> > > 
> > > 		
> > > __________________________________ 
> > > Do you Yahoo!? 
> > > Yahoo! Personals - Better first dates. More second
> > dates. 
> > > http://personals.yahoo.com
> > 
> > 
> > 
> > 
> 
> 
> 		
> __________________________________ 
> Do you Yahoo!? 
> Make Yahoo! your home page 
> http://www.yahoo.com/r/hs





------------------------ Yahoo! Groups Sponsor --------------------~--> 
What would our lives be like without music, dance, and theater?
Donate or volunteer in the arts today at Network for Good!
http://us.click.yahoo.com/Tcy2bD/SOnJAA/cosFAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

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/