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

[amibroker] Re: How to Optimize an AddToComposite



PureBytes Links

Trading Reference Links

Rick,
Have you tried this code ?
There are some questions:
Suppose for simplicity you run a database of 10 stocks and, before 
the optimization procedure, the MyComposite is 7,
ie 7/10 stocks are bullish [macd>signal]

Per1 = Optimize("Per1", Per1, 3, 13, 2);
Per2 = Optimize("Per2", Per2, 3, 13, 2);
C = Foreign("AA", "C", Fixup = True);
Bullish=MACD(Per1,Per2) >= Signal(Per1,Per2);
ZL = IIf(bullish==1, 1, -1)
MyComposite = MyComposite + ZL;
After this line, if all 6X6=36 combinations for AA are bullish, 
MyComposite will become 7+36=43 which sounds strange.
It would be better to see a full example, how MyComposite is involved 
in the procedure.
Dimitris Tsokakis 

--- In amibroker@xxxxxxxxxxxxxxx, "Rick Parsons" <RickParsons@xxxx> 
wrote:
> Dimitris, Chuck and Junya,
> 
> I found a way to optimize an AddToComposite in another way.  
Instead of using AddToComposite, do this:
> (this is a modification of my code to simplify it for illustration 
purposes.  There may be coding errors)
> 
> This counts the number of stocks above or below the MACD Signal 
line.
> 
> Per1 = 5; Per2 = 8;
> Per1 = Optimize("Per1", Per1, 3, 13, 2);
> Per2 = Optimize("Per2", Per2, 3, 13, 2);
> 
> C = Foreign("AA", "C", Fixup = True);
> Bullish=MACD(Per1,Per2) >= Signal(Per1,Per2);
> ZL = IIf(bullish==1, 1, -1)
> MyComposite = MyComposite + ZL;
> 
> C = Foreign("AXP", "C", Fixup = True);
> Bullish=MACD(Per1,Per2) >= Signal(Per1,Per2);
> ZL = IIf(bullish==1, 1, -1)
> MyComposite = MyComposite + ZL;
> 
> Repeat for each stock in the watchlist you want to scan.
> One can then use MyComposite as if it were a real "~MyComposite" 
data file.
> And one can optimize as shown in the top lines.
> One would insert the BUY/SELL lines after this code.
> 
> It can also be used in IB to plot the MyComposite results in real 
time without having to run a SCAN.
> 
> A little awkward but with cut and paste, the code can be setup 
pretty fast.
> 
> 
> Rick
>   -----Original Message-----
>   From: Chuck Rademacher [mailto:chuck_rademacher@x...]
>   Sent: Tuesday, May 06, 2003 3:00 PM
>   To: amibroker@xxxxxxxxxxxxxxx
>   Subject: RE: [amibroker] Optimizing AddToComposite
> 
> 
>   G'day, Rick.
> 
>   I'm not sure how you could determine the best to use, but you 
could do six runs at once by using the O,H,L.C.V and OI fields in 
your composite to hold the results from six different periods.   This 
might not be the answer you are looking for, but it may give you an 
idea.
>     -----Original Message-----
>     From: Rick Parsons [mailto:RickParsons@x...]
>     Sent: Tuesday, May 06, 2003 2:53 PM
>     To: amibroker@xxxx
>     Subject: [amibroker] Optimizing AddToComposite
> 
> 
>     I have a system similar to Dimitri's Trade the Market where I 
use AddToComposite to count the number of stocks above or below the 
MACD Signal line.
> 
>     Question is, what is the best MACD period to use?  It is very 
cumbersome to change the periods, run the Scan to create an 
AddToComposite, then backtest it.
> 
>     Does anyone have a creative idea on how to "optimize" the 
periods used to create the AddToComposite?
> 
>     Thanks,
>     Rick
> 
> 
> 
>     Send BUG REPORTS to bugs@xxxx
>     Send SUGGESTIONS to suggest@xxxx
>     -----------------------------------------
>     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 the Yahoo! Terms of 
Service. 
> 
> 
>         Yahoo! Groups Sponsor 
>        
>        
> 
>   Send BUG REPORTS to bugs@xxxx
>   Send SUGGESTIONS to suggest@xxxx
>   -----------------------------------------
>   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 the Yahoo! Terms of 
Service.


------------------------ Yahoo! Groups Sponsor ---------------------~-->
Rent DVDs Online - Over 14,500 titles.
No Late Fees & Free Shipping.
Try Netflix for FREE!
http://us.click.yahoo.com/YoVfrB/XP.FAA/uetFAA/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/