PureBytes Links
Trading Reference Links
|
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 <howardbandy@xxxxxxxxx> 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 <chwinc2000@xxxxxxcom> 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.
__._,_.___
Please note that this group is for discussion between users only.
To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com
For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/
For other support material please check also:
http://www.amibroker.com/support.html
SPONSORED LINKS
__,_._,___
|