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

Re: [amibroker] Re: Trouble with Coding Vidya In AFL and CMO



PureBytes Links

Trading Reference Links

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 hello,
   
        
 
 Chande momentum oscillator:http://www.amibroker.com/library/detail.php?id=239
 
                
 
function CMO(periods)
{
aP=sign(C-Ref(C,-1));
da=abs(C-Ref(C,-1));
return 100*Sum(aP*da ,Periods)/Sum(da,Periods);
}
 
You may verify the equivalence with
 
Periods=5;
CMO1=100*((Sum(IIf(C>Ref(C,-1),(C-Ref(C,-1)),0),Periods))-(Sum(IIf(C<Ref(C,-1),(Ref(C,-1)-C),0),Periods)))/((Sum(IIf(C>Ref(C,-1),(C-Ref(C,-1)),0),Periods)+(Sum(IIf(C<Ref(C,-1),(Ref(C,-1)-C),0),Periods))));
Plot(CMO1,"CMO1",colorBlack,1);
function CMO(periods)
{
aP=sign(C-Ref(C,-1));
da=abs(C-Ref(C,-1));
return 100*Sum(aP*da ,Periods)/Sum(da,Periods);
}
CMO2=CMO(Periods);
Plot(CMO2,"CMO2",colorWhite,8);
 

 or
 

CMO=100*((Sum(IIf(C>Ref(C,-1),(C-Ref(C,-1)),0),Periods))-(Sum(IIf(C<Ref(C,-1),(Ref(C,-1)-C),0),Periods)))/((Sum(IIf(C>Ref(C,-1),(C-Ref(C,-1)),0),Periods)+(Sum(IIf(C<Ref(C,-1),(Ref(C,-1)-C),0),Periods))));
 

--- N !!
 

----------------------------------------------------------------
 
 
----- Original Message -----
From: "rajak1981" <rajak1981@xxxxxxxxx>
Sent: Saturday, July 09, 2005 2:05 PM
Subject: [amibroker] Re: Trouble with Coding Vidya In AFL

> CMO=Chande momentum oscillator.
> Anyone figure out what is wrong with my code yet?
>
>
> --- In
amibroker@xxxxxxxxxxxxxxx, Graham <kavemanperth@x...> wrote:
> > What is CMO ?
> >
> > On 7/9/05, m.smith <
ink@x...> wrote:
> > >
> > > People,  I get a syntax error and it says  expecting an
> identifier. Marshall
> > >  
> > > 
> > > -------Original Message-------
> > > 
> > > From: bilbod
> > > Date: 07/08/05 13:57:53
> > > To:
amibroker@xxxxxxxxxxxxxxx
> > > Subject: Re: [amibroker] Trouble with Coding Vidya In AFL
> > >  Below is Vidya someone posted here a while back.
> > >
> > > Bill
> > > ---
> > > Length=21;
> > > Smooth=5;
> > >
> > > Change = C - Ref( C, -1 );
> > > SU = Sum( C - Ref( C, -1 ) > 0, Length );
> > > SD = Sum( C - Ref( C, -1 ) < 0, Length );
> > > CMO = 100 * ( SU - SD ) / ( SU + SD );
> > >
> > > AbsCMO=( abs(CMO) )/100;
> > >
> > > SC=2/(Smooth+1);
> > >
> > > VIDYA=AMA( C, SC*AbsCMO );
> > >
> > > Plot( Close, "Price", 4, 64 );
> > > Plot( VIDYA, "Vidya", 5 );
> > > ---
> > > rajak1981 wrote:
> > >
> > > > I am using the following code for vidya.
> > > > When I plot Vidya , Vidya[0] is initialized fine
> > > > But after that its all empty.
> > > > Any idea as to what I am doing wrong?
> > > > Factor[i] is being computed correctly as can be seen from the
> plot.
> > > > The problem is occuring due to Vidya[i-1]. I am not sure why.
> > > >
> > > >       SC=0.5;
> > > >       Vidya[0]=C[0];
> > > >       CMO_Up=Sum( IIf( C > Ref(C,-1) ,  C-Ref(C,-
> 1) ,0 ) ,Length ) ;
> > > >       CMO_Dn=Sum( IIf( C < Ref(C,-1) , Ref(C,-1) -
> > > > C  ,0 ) ,Length );
> > > >
> > > >
> > > >
> > > > for(i=1;i<BarCount;i++)
> > > > {
> > > >       CMO[i]=(( CMO_Up[i] -CMO_DN[i])  /( CMO_Up[i]+CMO_Dn[i]));
> > > >       AbsCMO[i]=(abs(CMO[i]));
> > > >       Factor[i]=SC*AbsCMO[i];
> > > >     Vidya[i]=(Factor[i]*C[i])+(1-Factor[i])*Vidya[i-1];
> > > > }
> > > >
> > > > Plot(Vidya,"Vidya("+Length+")",styleLine);
> > > > Plot(Factor,"Factor("+Length+")",styleLine);
> > > >
> > > > Thanks,
> > > > Raja
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > 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
> > > >       <
http://groups.yahoo.com/group/amibroker>" on the
> > > web.
> > > >       
> > > >     *  To unsubscribe from this group, send an email to:
> > > >       
amibroker-unsubscribe@xxxxxxxxxxxxxxx
> > > >     
> > > <
mailto:amibroker-unsubscribe@xxxxxxxxxxxxxxx?subject=Unsubscribe>
> > > >       
> > > >     *  Your use of Yahoo! Groups is subject to the Yahoo! Terms
> of
> > > >       Service <
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
> > >
> > >
> > >
> > > 
> > > 
> > >
> > > 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:
> > > 
amibroker-unsubscribe@xxxxxxxxxxxxxxx
> > >  
> > >  Your use of Yahoo! Groups is subject to the Yahoo! Terms of
> Service.
> > >  To unsubscribe from this group, send an email to:
> > > 
amibroker-unsubscribe@xxxxxxxxxxxxxxx
> > >  
> > >  Your use of Yahoo! Groups is subject to the Yahoo! Terms of
> Service.
> > >  Your use of Yahoo! Groups is subject to the Yahoo! Terms of
> Service.
> > > ________________________________
> > >
> > >
> >
> >
> > --
> > Cheers
> > Graham
> >
http://e-wire.net.au/~eb_kavan/
>
>
>
>
> ------------------------ Yahoo! Groups Sponsor --------------------~-->
> Try Online Currency Trading with GFT. Free 50K Demo. Trade
> 24 Hours. Commission-Free.
>
http://us.click.yahoo.com/DldnlA/9M2KAA/U1CZAA/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/
>  
>
>


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





SPONSORED LINKS
Investment management software Investment property software Investment software
Investment tracking software Return on investment software Stock investment software


YAHOO! GROUPS LINKS