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

[amibroker] Re: OUT/UNDERperformance



PureBytes Links

Trading Reference Links

In order to select automatically the additional conditions and 
improve your basic trading system, you may try the optimization

MeanDratio=Foreign("~Dratio40","C")/Foreign("~COUNT","V");
MeanRSI=Foreign("~SUMRSI","C")/Foreign("~COUNT","V");
MeanStochD=Foreign("~MEANSTOCHD","C")/Foreign("~COUNT","V");
OUTpSTOCHD=StochD()>MeanStochD;
UNDERpSTOCHD=StochD()<=MeanStochD;
OUTpRSI=RSI()>MeanRSI;
UNDERpRSI=RSI()<=MeanRSI;
Dratio=500*(H-L)/(H+L);
Dratio40=DEMA(Dratio,40);
OUTpDRATIO=Dratio40>MeanDratio;
UNDERpDRATIO=Dratio40<=MeanDratio;
T=ValueWhen(IsTrue(MeanDratio) AND IsTrue(MeanRSI) AND IsTrue
(MeanStochD),DateNum());
TT=DateNum()==T;
K=Optimize("K",7,1,7,1);KK=Optimize("KK",7,1,7,1);
COND1=IIf(K==1,OUTpSTOCHD,
IIf(K==2,UNDERpSTOCHD,
IIf(K==3,OUTpRSI,
IIf(K==4,UNDERpRSI,
IIf(K==5,OUTpDRATIO,
IIf(K==6,UNDERpDRATIO,1))))));
COND2=IIf(KK==1,OUTpSTOCHD,
IIf(KK==2,UNDERpSTOCHD,
IIf(KK==3,OUTpRSI,
IIf(KK==4,UNDERpRSI,
IIf(KK==5,OUTpDRATIO,
IIf(KK==6,UNDERpDRATIO,1))))));

Buy=Cross(StochD(),30);Sell=Cross(StochD(),70);//Your system example
Buy=ExRem(Buy,Sell);Sell=ExRem(Sell,Buy);//*see below text 
Buy=TT*(Buy AND COND1);Sell=TT*(Sell AND COND2);
Buy=ExRem(Buy,Sell);Sell=ExRem(Sell,Buy);

* The combination K=7, KK=7 is the basic system without any additives
* A combination K=4, KK=7 means "Buy when RSI underperforms, Sell 
normal"
* You may not exrem before applying the additives and leave secondary 
Buy to act
DT


--- In amibroker@xxxxxxxxxxxxxxx, "Dimitris Tsokakis" <TSOKAKIS@xxxx> 
wrote:
> After the RSI() example, we may generalise the OUT/UNDER 
performance using the following definition:
> A stock UNDERperforms the market when an Indicator is lower than 
the respective MeanIndicator and
> OUTperforms the market when an Indicator is higher than the 
respective MeanIndicator.
> To see the impact on trading systems let us give some examples:
> The MeanStochD, the MeanRSI and the MeanDratio.
> In AA window paste the
> 
> Dratio=500*(H-L)/(H+L);
> Dratio40=DEMA(Dratio,40);
> AddToComposite(Dratio40,"~SUMDratio40","C");
> AddToComposite(StochD(),"~SUMSTOCHD","C");
> AddToComposite(RSI(),"~SUMRSI","C");
> AddToComposite(1,"~COUNT","V");
> Buy=0;
> 
> scan for all stocks, all quotations and create the respective 
MeanIndicators
> 
> MeanDratio=Foreign("~SUMDratio40","C")/Foreign("~COUNT","V");
> MeanRSI=Foreign("~SUMRSI","C")/Foreign("~COUNT","V");
> MeanStochD=Foreign("~SUMSTOCHD","C")/Foreign("~COUNT","V");
> 
> useful to write the OUT/UNDERperformance Conditions
> 
> OUTpSTOCHD=StochD()>MeanStochD;
> UNDERpSTOCHD=StochD()<=MeanStochD;
> OUTpRSI=RSI()>MeanRSI;
> UNDERpRSI=RSI()<=MeanRSI;
> Dratio=500*(H-L)/(H+L);
> Dratio40=DEMA(Dratio,40);
> OUTpDRATIO=Dratio40>MeanDratio;
> UNDERpDRATIO=Dratio40<=MeanDratio;
> 
> and, finally, enhance your trading rules with the above conditions.
> Example
> Buy=...your Buy rule here
> Sell=...your Sell rule here
> Buy=Buy AND OUTpSTOCHD;// Buy only when the stock Outperforms the 
market, according to StochD criterion
> Sell=Sell AND UNDERpDRATIO;// Sell only when the stock 
Underperforms the market, according to Dratio  criterion
> 
> Some combinations are quite interesting and may improve your 
results.
> Dimitris Tsokakis
> [to be continued]


------------------------ Yahoo! Groups Sponsor ---------------------~-->
Get A Free Psychic Reading! Your Online Answer To Life's Important Questions.
http://us.click.yahoo.com/Lj3uPC/Me7FAA/ySSFAA/GHeqlB/TM
---------------------------------------------------------------------~->

Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/