[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


I'm getting good results from this routine. Thanks for posting it. 
Multiple Trade Arrows
e
I'm no expert but I've been told that it's always good practice
to add the following two lines to a trading routine after coding and 
combining the boolean logic.  

Buy = EXREM(Buy,Sell);
Sell = EXREM(Sell,Buy); 

Both EXREM statements will strip out the extra trade signals between 
the BUY and the next SELL, and between a SELL followed by the next 
BUY.  

One way that I debug is to add a series of ADDCOLUMNS at the end of 
the routine, and study it to see if it's doing what I expect. Run 
EXPLORE on your basket of stocks that you're trading or on one 
candidate that's traded and see if the results meet you expectation.

For example
Filter =1;    // will produce a row of results for every bar
Addcolumn(BUY,"BUY"); 
Addcolumn(SELL,"SELL"); 
// and if you want to see if your logic is working insert
// the following to check each logic ops. You can see that's
// it's a one or zero. 
Addcolumn(weekHistRising, "WeekHistRising"); 

I have not used ISTRUE much except in WRITEVAL statements. It 
probably works ok, but the results of your logical operationos will  
either be a 1 or a 0, so the ISTRUE is not needed. 

Hope this helps
JOE 


--- In amibroker@xxxxxxxxxxxxxxx, "theoldchartreader" 
<theoldchartreader@xxxx> wrote:
> 
> 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/