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

[amibroker] Re: New user: trying to program Elder's impulse system



PureBytes Links

Trading Reference Links


Hi, Try this fromula.
Dennis

Plot(EMA(C,13)>Ref(EMA(C,13),-1)AND
MACD()>Ref(MACD(),-1),"Impluse",colorGreen,styleHistogram);  
Plot(EMA(C,13)<Ref(EMA(C,13),-1)AND
MACD()<Ref(MACD(),-1),"Impluse",colorRed,styleHistogram);  






--- In amibroker@xxxxxxxxxxxxxxx, "polomorabe" <paul.moore@xxxx> 
wrote:
> 
> Hello,
> 
> I'm a new user of Amibroker (since yesterday!), and as an exercise 
> to learn how to user AFL, I'm trying to program Elder's Impulse 
> System, as described in his book "Come Into MY trading Room". 
> 
> Briefly, this system generates a buy signal if:
> (Weekly 13EMA OR MACD-H are rising) AND
> (Yesterday's daily 13EMA was falling and today's is rising AND
>  Yesterday's daily MACD-H was falling and today's is rising)
> 
> The system generates a sell signal when any of the four boolean 
> conditions is no longer true.
> 
> When I run this, I get loads of arrows pasted onto the chart, so I 
> as wondering if there is a debug mode available, to help me to find 
> the problem?
> 
> In any case, here's the code. Many thanks for your help:
> 
> // 
> // Elder Impulse System scan
> //
> 
> // Get weekly MACD-H and EMA arrays
> TimeFrameSet( inWeekly );
> weekHist = MACD( 12, 26 ) - Signal( 12, 26, 9 );
> weekEMA = EMA( Close, 13 );
> 
> // Determine if weekly MACD-H is rising or falling
> weekHistRising = IsTrue ( Ref(weekHist, -1) < Ref(weekHist, 0) );
> weekHistFalling = IsTrue ( Ref(weekHist, -1) > Ref(weekHist, 0) );
> 
> // Determine if 13-week EMA is rising or falling
> weekEMARising = IsTrue ( Ref(weekEMA, -1) < Ref(weekEMA, 0) );
> weekEMAFalling = IsTrue ( Ref(weekEMA, -1) > Ref(weekEMA, 0) );
> 
> // Get daily MACD-H and EMA arrays
> TimeFrameRestore();
> dayHist = MACD( 12, 26 ) - Signal( 12, 26, 9 );
> dayEMA = EMA( Close, 13 );
> 
> // Determine if daily MACD-H has changed from negative to positive 
> or vice versa
> dayHistUpturn = IsTrue ( ( Ref(dayHist, -2) > Ref(dayHist, -1) ) 
AND 
> ( Ref(dayHist, -1) < Ref(dayHist, 0) ) );
> dayHistDownturn = IsTrue ( ( Ref(dayHist, -2) < Ref(dayHist, -1) ) 
> AND ( Ref(dayHist, -1) > Ref(dayHist, 0) ) );
> 
> // Determine if 13-day EMA has changed from negative to positive or 
> vice versa
> dayEMAUpturn = IsTrue ( ( Ref(dayEMA, -2) > Ref(dayEMA, -1) ) AND ( 
> Ref(dayEMA, -1) < Ref(dayEMA, 0) ) );
> dayEMADownturn = IsTrue ( ( Ref(dayEMA, -2) < Ref(dayEMA, -1) ) AND 
> ( Ref(dayEMA, -1) > Ref(dayEMA, 0) ) );
> 
> // Generate buy or sell signals
> Buy = IsTrue( ( weekHistRising OR weekEMARising ) AND ( 
> dayHistUpturn AND dayEMAUpturn ) );
> Sell = IsTrue( dayHistDownturn OR dayEMADownturn );





------------------------ Yahoo! Groups Sponsor --------------------~--> 
What would our lives be like without music, dance, and theater?
Donate or volunteer in the arts today at Network for Good!
http://us.click.yahoo.com/Tcy2bD/SOnJAA/cosFAA/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/