PureBytes Links
Trading Reference Links
|
Hello
Walt was kind enough to provide me with the following code - I hope he
doesn't mind if I share it around. This is something you can try, and
maybe you can adapt it if it isn't providing exactly what you need.
Basically, it takes care of the trailing stop which kicks in after
*MinGainPct* amount of profit has been reached. The trailing stop will
close the position after *trailPct* of the profit beyond the *MinGainPct
*profit has been given back I think you have to set up the hard stop
'behind the entry' separately, but that shouldn't be a problem.
buyat=BuyPrice;
MinGainPct=.04;
trailPct=15;
pct=IIf((MA(C,2)-buyat)/buyat > MinGainPct,trailPct,9999);
ApplyStop(stopTypeTrailing,stopModeRisk,pct,1,True);
Hope this helps
Nik
hithere2222 wrote:
>
>
> I know this has been asked a thousand times before but I can't seem
> to find it in the archives so here it goes.
>
> I am trying to put a trailing stop in my system which two fold.
>
> I need a static stop a certain number of points behind the entry
> and then I need it to change to a trailing stop once a certain
> amount of profit is achieved.
>
>
> Can someone tell me the miracle code to do this?
>
> I would appreciate it.
>
> Thanks
>
>
>
>
>
>
>
>
>
> Check AmiBroker web page at:
> http://www.amibroker.com/
>
> Check group FAQ at:
> http://groups.yahoo.com/group/amibroker/files/groupfaq.html
>
>
> *Yahoo! Groups Links*
>
> * To visit your group on the web, go to:
> http://groups.yahoo.com/group/amibroker/
>
> * To unsubscribe from this group, send an email to:
> amibroker-unsubscribe@xxxxxxxxxxxxxxx
> <mailto:amibroker-unsubscribe@xxxxxxxxxxxxxxx?subject=Unsubscribe>
>
> * Your use of Yahoo! Groups is subject to the Yahoo! Terms of
> Service <http://docs.yahoo.com/info/terms/>.
>
>
--
The majority meet with failure because of their lack of persistence in creating new plans to take the place of those which fail.
------------------------ Yahoo! Groups Sponsor --------------------~-->
In low income neighborhoods, 84% do not own computers.
At Network for Good, help bridge the Digital Divide!
http://us.click.yahoo.com/EpW3eD/3MnJAA/cosFAA/GHeqlB/TM
--------------------------------------------------------------------~->
Check AmiBroker web page at:
http://www.amibroker.com/
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/amibroker/
<*> 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/
|