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

Re: [amibroker] A Challenge for all you code wizards .....



PureBytes Links

Trading Reference Links

Nightstalker:

Been playing with MMAs for a while now. I find them difficult to code.
(The time it took me to come up with this is about 5 times as long as an eyeball of all the charts in my watchlist might take, but still worth the exercise)

Exploration:

*****
/* Exploration for Guppy MMA Cross over, shorts having just crossed the Longs AND spreading apart.
The divergence of short MMAs may lead or lag the crossover.
Use differing values for the lookback p, and the MinCP and MaxCP values. Also the DG value.
These values get most of the setups you described in my 50c to 300c watchlist.
Add your own price/volume filters. */


/* Set the no of days ago
Long value returns fewer results.
shorter value returns more results.*/

p = Cross_no_days_ago = 4;

MinCP = Minimum_CrossPeriod = 0.5 * p; /* you may choose different values here*/
MaxCP = Maximum_CrossPeriod = 2 * p; /* choose different values here.*/

/* Add the values of the short and long Guppy MMAs, as a proxy for the long and short MMAs. Adjust to suit your own ema values.*/
sumShort = ( EMA(C,3) + EMA(C,5) + EMA(C,8) + EMA(C,10) + EMA(C,12) + EMA(C,15) ) ;
sumLong = ( EMA(C,30) + EMA(C,35) + EMA(C,40) + EMA(C,45) + EMA(C,50) + EMA(C,60) );

/*Shorts cross the Longs*/
Cond1 = Cross(Sumshort,Sumlong);


Diff = EMA(C,3) - EMA(C,15);
DG = DivergingGreens = Sum( Diff > Ref(Diff,-1), p) ==  p;
/*choose different values here eg p/2 to find more candidates */

Filter =
BarsSince(Cond1) == p /* your conditions exactly. Few results*/
// BarsSince(Cond1) > MinCP and BarsSince(Cond1) <= MaxCP /*finds more results, less strict criteria */
AND
Diff > 0 /* for bullish, rising Short MMMAs.*/
AND
DG
AND
EMA(C,15) > Max(EMA(C,30),EMA(C,60))/*short MMAs must stay above the reds. Some retracement is possible.*/
;

AddColumn(Ref(Diff,-4),"Diff-4",1.3);
AddColumn(Ref(Diff,-3),"Diff-3",1.3);
AddColumn(Ref(Diff,-2),"Diff-2",1.3);
AddColumn(Ref(Diff,-1),"Diff-1",1.3);
AddColumn(Diff,"Diff",1.3);

Plot(Sumshort,"sumshort",colorGreen,1);
Plot(Sumlong,"sumlong",colorRed,1);

*****
This is all I have been able to come up with.
If you come up with something better, let me know.

ChrisB



Yahoo! Music Unlimited - Access over 1 million songs. Try it free.

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





SPONSORED LINKS
Investment management software Real estate investment software Investment property software
Software support Real estate investment analysis software Investment software


YAHOO! GROUPS LINKS