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

[amibroker] Re: Entry signals



PureBytes Links

Trading Reference Links

Below is an example of ANDing the conditions of MACD, ADX and two 
EMAs. You can also and price and volume ranges if you like. The 
result of the code are buy and sell pulses when these conditions 
match and I deleted all additional signals up to the next direction 
change. 

Use explore to get a list of stocks that meed the criteria. On the 
Analysis window select the stocks list you want, all or watch list, 
and set the range TO and FROM to the same date. Explore will pop out 
a list that you can copy into a watch list. Don't use n last days 
unless your database is clean. Stocks that no longer trade will pop 
up in the list and it is confusing. They may not have traded for 
months.

Barry

_SECTION_BEGIN("ADX + EMA + MACD");

// This combines three indicators into one timing Signal

tgl = ParamToggle("Result", "AND logic|Compare");
// ema 
emaPrice = ParamField("Ema Price field", 3);
PeriodShort = Param("Ema Short Periods", 5, 2, 20, 1);
PeriodLong = Param("Ema Long Periods", 15, 2, 100, 1);
pS = EMA(emaPrice , PeriodShort);
pL = EMA(emaPrice , PeriodLong);
upEma = IIf(pS > pL, 1, 0);		// fast ema is above slow, 
long condition

// adx di lines
range = Param("ADX Periods", 10, 2, 200, 1 );
myPdi = PDI(range );
myMdi = MDI(range );
upAdx = IIf( myPdi > myMdi, 1, 0);

// macd 
r1 = Param( "Macd Fast avg", 12, 2, 200, 1 );
r2 = Param( "Macd Slow avg", 26, 2, 200, 1 );
r3 = Param( "Macd Signal avg", 9, 2, 200, 1 ); 
myMacd = MACD(r1,r2);
mySignal = Signal(r1,r2,r3);
upMacd = IIf(myMacd  > mySignal, 1, 0);

// switch test calculation and compare the results
if(tgl)
{
myBuy = upEma AND upAdx  AND upMacd;
myShort = !upEma AND !upAdx AND !upMacd; 
}
else
{
myBuy = IIf(pS > pL AND myMacd > mySignal AND myPdi > myMdi,1,0);
myShort = IIf(pS < pL AND myMacd < mySignal AND myPdi < myMdi,1,0);
}

Buy = Cover = ExRem(myBuy, myShort);
Short = Sell = ExRem(myShort, myBuy);

Plot( Buy * C, "ADX(" + NumToStr(range,1.0) + 
	") EMA(" + NumToStr(PeriodShort,1.0) + "," + NumToStr
(PeriodLong,1.0) +
	") MACD(" + NumToStr(r1,1.0) + "," + NumToStr(r2,1.0) + "," 
+ NumToStr(r3,1.0) + 
	") - myBuy ",  colorGreen); // a positive spike that 
indicates a buy or cover trade.
Plot( -Short * C , "myShort ", colorRed); 

// exploration
Filter = Buy OR Short; 
AddColumn(Close, "Close", 1.2);
AddColumn(Buy, "Buy", 1.0);
AddColumn(Short, "Short",1.0);

_SECTION_END();


--- In amibroker@xxxxxxxxxxxxxxx, Graham <kavemanperth@xxxx> wrote:
>
> Easiest is to use the Cross function
> 
> MA10=MA(C,10);
> 
> Buy= Cross( MA10, Ref(MA10,-1) );
> Sell=Cross( Ref(MA10,-1), MA10 );
> 
> 
> 
> 
> On 11/3/05, ianjw2 <ijw@xxxx> wrote:
> >
> > I want to be able to scan a list of symbols and get signals that 
are
> > initiated for today only.
> >
> > For example - if I scan the ASX200 with the simple system below, 
I get
> > a list of all stocks that are rising or falling on the scan 
date. But,
> > what I want is only those stocks that actually trigger today. Is 
this
> > possible to do using the system filter, or does one have to 
rewrite the
> > code to capture only the trigger signals? My system is bit more 
complex
> > than the one below, and for me, it would be a bit of a chore to
> > rewrite. If I did go to all that trouble, and then find there is 
a
> > simple solution, I would be a bit miffed.
> >
> > Cheers
> > Ian
> >
> >
> >
> > MA10=MA(C,10);
> >
> > Buy=MA10>Ref(MA10,-1);
> > Sell=MA10<Ref(MA10,-1);
> >
> >
> >
> >
> >
> >
> > 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
> >
> >
> >
> >
> >
> >
> >
> 
> 
> --
> Cheers
> Graham
> AB-Write >< Professional AFL Writing Service
> Yes, I write AFL code to your requirements
> http://e-wire.net.au/~eb_kavan/ab_write.htm
>







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