PureBytes Links
Trading Reference Links
|
Alexei, try this:
MetaStock -> Tools -> Indicator Builder -> New
-> Copy and paste indicator formula below.
========================
Trailing Stop - TradeSim
========================
---8<---------------------------
{ Triggers: Long (+1) & Short (-1) signals at
crossover of user-defined trailing stops }
{ x23 faster than MetaStock's 4-PREV version }
{ TradeSim.dll must be in
...\MetaStock\External Function DLLs\ folder }
{ ©Copyright 2003-2004 Jose Silva }
{ http://www.metastocktools.com }
{ User inputs }
buffer:=Input("buffer % trailing stop",0,100,20);
plot:=Input("plot: trailing stop=1, Long+Short=2, signals=3",1,3,1
);
adv:=Input("plot: today's trailing stop=0, tomorrow's stop=1",0,1,0
);
delay:=Input("Entry and Exit signal delay",0,5,0);
{ Trailing stop - Long & Short }
Volatility:=C*buffer/100;
stopLong:=ExtFml("TradeSim.TrailingStop",
BAND, {mode: band or trigger}
LONG, {long or short}
Volatility, {user defined see variable above}
CLOSE, {RefPoint for stop calc}
CLOSE); {threshold - stop breached}
stopShort:=ExtFml("TradeSim.TrailingStop",
BAND,SHORT,Volatility,C,C);
{ Basic latch, signals }
In:=Cross(C,Ref(stopShort,-1));
Out:=Cross(Ref(stopLong,-1),C);
Init:=Cum(In+Out>-1)=1;
InInit:=Cum(In)=1;
flag:=BarsSince(Init OR In)
< BarsSince(Init OR Out)+InInit;
signals:=Ref((InInit AND Alert(InInit=0,2)
OR flag AND Alert(flag=0,2))
-(flag=0 AND Alert(flag,2)),-delay);
stop:=Ref(If(flag=1,stopLong,stopShort),-1+adv);
{ Plot on price chart }
If(plot=1,stop,
If(plot=2,Ref(stopLong,-1+adv),0));
If(plot=1,stop,
If(plot=2,Ref(stopShort,-1+adv),signals))
---8<---------------------------
> BTW Somebody knows, when Jose will return from holiday?
I've just got back. With some luck, I'll catch up with my work and
start posting regularly soon. :)
jose '-)
http://www.metastocktools.com
--- In equismetastock@xxxxxxxxxxxxxxx, "Alexei" <alexeiklo@xxxx>
wrote:
> Somebody please help.
> My Trailing Stop is the basic problem. Somebody use MSST Trailing
> with TradeSim? Key rules of thumb in my system are the Trailing Stop
> with 20 % of profit risk and "Exit at StopPrice". It's easy to
> install in MS (simply check corresponding checkboxes); but how to
> write this for TS??? Unfortunately must admit, that I am rookie in
> system design, and I read manual using program-translator, which
> oftenchange the meaning drastically.
> BTW Somebody knows, when Jose will return from holiday?
> Thanks in advance.
------------------------ Yahoo! Groups Sponsor --------------------~-->
Put more honey in your pocket. (money matters made easy).
http://us.click.yahoo.com/r7D80C/dlQLAA/cosFAA/BefplB/TM
--------------------------------------------------------------------~->
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/equismetastock/
<*> To unsubscribe from this group, send an email to:
equismetastock-unsubscribe@xxxxxxxxxxxxxxx
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|