PureBytes Links
Trading Reference Links
|
Here is an attempt to use Equity conditions and redefine
trading rules.
The system applies the original trading rules only whenthe
Equity line is above its 40-day EMA
and stops [with the appropriate order] any trade when the
Equity line falls below its 40-day EMA.
It begins a new trade, the one that the original systemwould
apply this day, when the Equity line crosses ascending its 40-day
EMA
// the original trading
systemBlevel =13;Slevel
=85;StOcci=100*(CCI(6)-LLV(CCI(6),14))/(HHV(CCI(6),14)-LLV(CCI(6),14));stocci=MA(stocci,5);Buy=Cross(STOCCI,BLEVEL);Sell=
Cross(STOCCI, Slevel); Short = Sell;Cover =
Buy;Buy=ExRem(Buy,Sell);Sell=ExRem(Sell,Buy);Short=ExRem(Short,Cover);Cover=ExRem(Cover,Short);
E1=Equity();EM40=MA(E1,40);<FONT
color=#ff0000>// Equity
conditionCOND=E1>EM40;XB=Flip(Buy,Sell);// preserve the
original buy till the next
sellXS=Flip(Sell,Buy);XSH=Flip(Short,Cover);// preserve the original
Short till the next CoverXCO=Flip(Cover,Short);<FONT
color=#ff0000>// Descending and ascending equity cross
conditionsDESCR=Cross(EM40,E1);ASCCR=Cross(E1,EM40);<FONT
size=2>// the new trading rules// How to begin a
tradeBuy=COND*Buy OR (ASCCR*XB);// {original
buy when E1>EM40} OR {a new buy when an ascending cross occur}
Short=COND*Short OR (ASCCR*XSH);// How to
stop a tradeSell=COND*Sell OR (DESCR*XB);// <FONT
color=#ff0000>{original sell when E1>EM40} OR { a new sell
when an ascending cross occur} Cover=COND*Cover OR
(DESCR*XSH);
The code seem to operate, although I do not feel so safe
adding new trading rules after the Equity line.
Any opinions/ideas/improvements/comments ?
Shall we ALWAYS improve a trading system performance with this
method ?
Dimitris Tsokakis
|