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

Re: [amibroker] Double EMA crossover, with a difference



PureBytes Links

Trading Reference Links

The following is not tested but it shows one way to do what
you want. 

cross10x20 = Cross (EMA(Close, 10 ),EMA(Close, 20));
cross20x50 = Cross (EMA(Close, 20 ),EMA(Close, 50)); 
last5daycross20x50 = sum(cross20x50,5) > 0 ;

BUY = cross10x20 AND last5daycross20x50 ;

That should do it (if I have understood what you want).

The "Sum" function is used to determine if there was 1 (or
more) 20x50 crosses in the last 5 days. 

By 5 days I assume you mean the same day as the 10x20 cross
plus 4 more days. If you want 5 days not counting the 10x20
cross day, then use 6 as the look back period for the sum
function. However, if you do NOT want to enter if the 10x20
and 20x50 cross on the same day use this:

BUY = cross10x20 AND cross20x50 AND ! cross20x50;

b


--- thorstef2003 <thorstef2003@xxxxxxxxx> wrote:

> I want to backtest a double EMA crossover.
> 
> Buy=Cross (EMA(Close, 10 ),EMA(Close, 20)) AND 
> Cross (EMA(Close, 20 ),EMA(Close, 50)); 
> 
> except that I would like to check if the 2nd crossover
> has occurred 
> anytime during the previous 5 days. It is non
> simultaneous.
> 1 How do I check for 20-50 crossABOVE on any day upto 5
> days ago?
> 2 How to sell automatically after 10 days are over?
> Found a danningham.afl that uses vbscript. I'm pretty OK
> with VB so can 
> anyone point me to a tutorial on using VB from AFL?
> 
> 
> 
> 



		
__________________________________ 
Yahoo! FareChase: Search multiple travel sites in one click.
http://farechase.yahoo.com


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