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

[amibroker] Rather Confused Newbie



PureBytes Links

Trading Reference Links

Hi,

I'm trying to set up a very basic system to determine if a stock
has met the following conditions:

1.  The RSI has crossed 50
2.  The MACD has crossed its Signal
3.  The EMA5 has crossed the EMA20

The following code will find the dates that all three
signals occur:

Buy=Cross(RSI(15),50) AND Cross(MACD(),Signal()) AND
Cross(EMA(C,5),EMA(C,20));

I'm not concerned with whether the crossings take place on the
same day, though.  I am interested in knowing the day
that the last of the 3 indicators does cross (assuming that
that the first two have crossed).  Following is
an approach that I've developed, but it seems very clumsy:

EMACross=Cross(EMA(C,5),EMA(C,20));
MACDCross=Cross(MACD(12,26),Signal(12,26,9));
RSICross=Cross(RSI(15),50);

SignalTrue=IIf(EMACross==MACDCross==RSICross==1,1,0);

Buy=SignalTrue=1 AND Cross(RSI(15),50) OR Cross(MACD(),Signal()) OR
Cross(EMA(C,5),EMA(C,20));

The first 3 lines set flags for the crossovers.  I believe that
I could simply put the crossover checks in the "IIf" statement
but this format seems easier for me to read.  In any case, I'm not
much of a programmer, and it seems that there must be a more direct
approach.  I've burned myself out looking at other code and such,
however, with no luck, and would appreciate if if someone with a
better programming background could offer some insight.

Thanks,


Wayne









------------------------ Yahoo! Groups Sponsor --------------------~--> 
Try Online Currency Trading with GFT. Free 50K Demo. Trade 
24 Hours. Commission-Free. 
http://us.click.yahoo.com/RvFikB/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/