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 [email protected], Howard B <howardba...@...> 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 <richpa...@...> 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
> >
> >  
> >
>


Reply via email to