Hi Howard,
   
  I would like to exit 5 days later if there isn't 2% gain, but I would like to 
keep it and let it run if there is already a 2% gain and let my 15% profit 
target stop take care of the exit.

Howard B <[EMAIL PROTECTED]> wrote:
          Greetings --

See if this helps.  Note I've changed the 5% to 2% -- there are not many 5% 
gains in 5 days.

Thanks,
Howard
www.quantitativetradingsystems.com 

//---------------------------------------------------------------------
//    ExitAfterFiveDays.afl
//

//    Put trade entry logic here.
MA1 = MA(C,3);
MA2 = MA(C,20);

Buy = Cross(MA1,MA2); 

//    Put trade exit logic here, but call the exit SellSystem
SellSystem = Cross(MA2,MA1);

//    Set a profit target stop at 2%, exit intraday
ApplyStop(stopTypeProfit,stopModePercent,2,1);

//  Combine the SellSystem with a timed exit after 5 days. 
//  If the profit target was reached, it would have taken the trade out first.
Sell = SellSystem OR (BarsSince(Buy)>=5);

//  Remove the extra arrow.
Buy = ExRem(Buy,Sell);
Sell= ExRem(Sell,Buy);

//  Plot everything
Plot(C,"C",colorBlack,styleCandle);
Plot(MA1,"MA1",colorGreen,styleLine);
Plot(MA2,"MA2",colorBlue,styleLine);
PlotShapes(Buy*shapeUpArrow+Sell*shapeDownArrow, 
    IIf(Buy,colorGreen,colorRed));



  On 4/2/07, chwinc2000 <[EMAIL PROTECTED]> wrote:             Hello,

Can someone please point me in the direction of how I would go about 
coding this?

Exit Rules --> I would like to exit 5 bars after entry if open profit 
is <5% gain.

Thank you for your help.








  

         

 
---------------------------------
Don't pick lemons.
See all the new 2007 cars at Yahoo! Autos.

Reply via email to