[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

Hi,

Use the Filter to screen for all tickers that made a cross on the most
recent bar. The previous close price is displayed in the exploration
results list.


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);

Filter = PRES_CROSS;

PREV_CLOSE = ValueWhen( PRES_CROSS, C, 2);
AddColumn( PREV_CLOSE, "PREV_CLOSE" );



Regards,
William Peters (AmiBroker Group Moderator)
www.amitools.com




Tuesday, December 21, 2004, 5:58:26 PM, you wrote:


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

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

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

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

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




------------------------ Yahoo! Groups Sponsor --------------------~--> 
$4.98 domain names from Yahoo!. Register anything.
http://us.click.yahoo.com/Q7_YsB/neXJAA/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/