| PureBytes Links Trading Reference Links | Thank you Howard,  I used to comment and uncomment separate Sell / ApplyStop statements and run my code for each option. This looks like a lot smarter solution. Thank you for sharing it with me. I assume that, each "case" is reported in separate column in Optimization report as "WhichExit" (I have not tested it yet).
Regards
Richard
--- In amibroker@xxxxxxxxxxxxxxx, Howard B <howardbandy@xxx> wrote:
>
> Hi Richard --
> 
> Something like this?
> 
> ///////////////////////////////////////////////////
> //    MultipleExits.afl
> //
> //    Buy the first trading day of the month
> Buy = Month() != Ref(Month(),-1);
> 
> WhichExit = Optimize("WhichExit",1,1,4,1);
> switch(WhichExit)
> {
>     case 1:
>     //    Sell the first Wednesday
>     Sell = DayOfWeek() == 3;
>     break;
> 
>     case 2:
>     //    Sell using a 1% profit target
>     ApplyStop(stopTypeProfit,stopModePercent,1,1);
>     break;
> 
>     case 3:
>     //    Sell after a 5 day holding period
>     ApplyStop( stopTypeNBar, stopModeBars, 5 );
>     break;
> 
>     default:
>     //    sell on the 20th
>     Sell = Day()>=20;
>     break;
> 
> }
> ////////////////////////////////////
> 
> Thanks,
> Howard
> 
> 
> On Fri, Jan 22, 2010 at 5:14 AM, Richard <richpach2@xxx> wrote:
> 
> >
> >
> > Hello,
> > Is it possible or practical to test six different exit strategies in one
> > optimization run?
> > Could anyone point me to code example how this can be implemented?
> >
> > Regards
> > Richard
> >
> >  
> >
>
------------------------------------
**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.
TO GET TECHNICAL SUPPORT send an e-mail directly to 
SUPPORT {at} amibroker.com
TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)
For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/
Yahoo! Groups Links
<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/
<*> Your email settings:
    Individual Email | Traditional
<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)
<*> To change settings via email:
    amibroker-digest@xxxxxxxxxxxxxxx 
    amibroker-fullfeatured@xxxxxxxxxxxxxxx
<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx
<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 |