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

RE: [amibroker] Previous close prices on n = -1 MACD cross?



PureBytes Links

Trading Reference Links

Hope this helps

M_LINE = MACD(RET_1, RET_2);
S_LINE = Signal(RET_1, RET_2, RET_3);

PRES_CROSS = Cross(M_LINE, S_LINE);
//PREV_CROSS = Cross(M_LINE, S_LINE);


PREV_CLOSE = ValueWhen(Cross(M_LINE, S_LINE), C, 2);//added comma and
changed 1 to 2 as the 1 will be last cross (present)

Cheers,
Graham
http://e-wire.net.au/~eb_kavan/

-----Original Message-----
From: Quad Rate Serial Abby [mailto:quad_pumped_abby@xxxxxxxxx] 
Sent: Wednesday, December 22, 2004 6:58 AM
To: amibroker@xxxxxxxxxxxxxxx
Subject: [amibroker] Previous close prices on n = -1 MACD cross?



I am trying to write code that will return the closing price on the 
date of the last cross of the signal line by the MACD line prior to 
a cross of the same type occuring today.  I have a selectio of code 
here, but am getting a syntax error trying to use the ValueWhen 
function.  Does anybody see anything wrong with this? TIA.

RET_1 = Prefs( 11 );
RET_2 = Prefs( 12 );
RET_3 = Prefs( 13 );

M_LINE = MACD(RET_1, RET_2);
S_LINE = Signal(RET_1, RET_2, RET_3);

PRES_CROSS = Cross(M_LINE, S_lINE);
PREV_CROSS = Ref(Cross(M_LINE, S_LINE), -1);

PREV_CLOSE = ValueWhen(Ref(Cross(M_LINE, S_LINE), -1) C, 1);






Check AmiBroker web page at:
http://www.amibroker.com/

Check group FAQ at:
http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
Yahoo! Groups Links



 




------------------------ Yahoo! Groups Sponsor --------------------~--> 
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

Check AmiBroker web page at:
http://www.amibroker.com/

Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.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/