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

Re: [amibroker] Re: MACD Predictor



PureBytes Links

Trading Reference Links

Didn't Dimitri publish an article on this in TASC magazine?


h


Wednesday, June 20, 2007, 6:41:49 AM, you wrote:


> George, I believe that what you want

> has already been done by Dimitris Tsokakis.

> For thread see:

> http://elitetrader.com/vb/showthread.php?

> s=&threadid=45378&highlight=The+probable+Cross+between+MACD+and+its+Si

> gnal


> directaim


> // The probable Cross between MACD and its Signal, by D. Tsokakis, 

> Feb2005

> //The code may be used as a good daily consultant for the probable 

> continuation of a trend. 


> SetBarsRequired(10000,0);

> function EMAn ( Cnext , p)

> {

> return ( 2 * Cnext + ( P - 1 ) * EMA ( C , P ) ) / ( P + 1 ) ;

> }

> function MACDn ( Cnext , p1 , p2 )

> {

> return EMAn ( Cnext ,p1 ) - EMAn ( Cnext , p2 ) ;

> }

> p1=12;p2=26;p=9;

> det = 500 ;

> perc = 25/100 ;

> Clast = SelectedValue ( C ) ;


> MACDlast = SelectedValue ( MACD() ) ; 

> SIGNALlast = SelectedValue ( Signal ( ) );


> Cnextmin = ( 1 - perc ) * Clast ;Cnextmax = ( 1 + perc ) * Clast ;

> step = ( Cnextmax - Cnextmin ) / det ;

> nextROC1 = -100 * perc ;

> nextROC2 = -100 * perc ;

> for ( Cnext = Cnextmin ; Cnext <= Cnextmax ; Cnext = Cnext + step )

> {

> X = MACDn ( Cnext , 12 , 26 ) ;

> Y = EMA ( X , 9 ) ;

> MACDnext = SelectedValue ( X );

> SIGNALnext = SelectedValue ( Y );

> NextROC = 100 * ( -1 + Cnext / Clast ) ;

> NextROC0 = 100 * ( -1 + Cnext / Clast ) ;

> if ( macdnext < SignalLAST )

> {

> NextROC1 = NextROC ; 

> }

> if ( MACDnext < MACDlast )

> {

> nextROC2 = nextROC0;

> }

> }


> --- In amibroker@xxxxxxxxxxxxxxx, "slamming26_11" <george.rayzis@xxx> 

> wrote:


>> r1 = Param( "Fast avg", 12, 2, 200, 1 );

>> r2 = Param( "Slow avg", 26, 2, 200, 1 );

>> r3 = Param( "Signal avg", 9, 2, 200, 1 );

>> mm = MACD(r1, r2);

>> ms = Signal(r1, r2, r3);

>> UpCrossover = Cross( mm, ms );

>> DownCrossover = Cross( ms, mm);

>> IIf( mm > ms, DownCrossover, UpCrossover );

>> ValueWhen( DownCrossover, Ref(C,1));

>> ValueWhen( UpCrossover, Ref(C,1));

>> MACDPredictor = ValueWhen( DownCrossover, Ref(C, 1)) OR

>> ValueWhen( UpCrossover, Ref(C,1));

>> Plot(MACDPredictor,"",4);


>> The above code is a my feeble attempt to show the very next future 

>> closing price that would create a crossover of the mm and ms. 

> Please 

>> help as I am not experienced with AFL coding.


>> Thanks.


>> George






> 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 NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:

> http://www.amibroker.com/devlog/


> 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/


> <*> Your email settings:

>     Individual Email | Traditional


> <*> To change settings online go to:

>     http://groups.yahoo.com/group/amibroker/join

>     (Yahoo! ID required)


> <*> To change settings via email:

>     mailto:amibroker-digest@xxxxxxxxxxxxxxx 

>     mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx


> <*> 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 NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

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

Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___