PureBytes Links
Trading Reference Links
|
Folks,
Attached is a variation on Tomasz's breakout code. This avoids the
problem of having to specify a percentage threshold as it uses the
average true range to dynamicaly determine if there has been a
breakout.
There is also code to ensure you are only looking at a stock which is
outperforming it's index and that index is out performing the whole
of market index (XAO - All ordinaries in Aust).
It's simple but pretty effective. The idea comes from Chris
Tate's 'The Art of Trading' Wrightbooks.
I still find exrem removes buy signals which I'm not expecting it to.
Any ideas anyone.
Tomasz ??
Geoff
/* Breakout - Afl implementation by Geoff Mulhall 18/4/2001 */
dollars = 5000;
range = 20;
maLong = 150;
maShort = 13;
maRelStr = 2;
/* sufficient liquidity ie share purchased less than 2% of weekly
volume*/
cond1 = dollars/close < 0.02 * sum(volume,maLong)/(maLong/5);
/* Breakout Criteria */
channeltop = ref(hhv(high,range), -1);
channelbottom = ref(llv(low,range),-1);
oneAtr = ref(atr(range),-1);
cond2 = close > channeltop + oneAtr;
/* one white soldiers detected */
cond3 = close > open;
/* gradient of the relative strength is increasing compared to its
index */
cond4 = ma(relstrength(""), maRelStr) >= ref(ma(relstrength(""),
maRelStr), -1 * maRelStr);
/* relative strength of the stocks index is increasing compared to
XAO*/
indexStr = relstrength("XAO")/relstrength("");
cond5 = ma(indexStr,maRelStr) >= ref(ma(indexStr, maRelStr), -1 *
maRelStr);
buy = cond1 AND cond2 AND cond3 AND cond4 AND cond5;
sell = 0;
/* buy = exrem(buy,sell); */
/* sell = exrem(sell,buy); */
|