PureBytes Links
Trading Reference Links
|
Hello Jose.
Certainly, we can talk here. I've written to you that letter because
has thought that you already with someone discussed it. Certainly
public discussion more informatively.
I'll remind my issue: how to use that indicator in my system?
Code of system in TradeSim Language for MS Explorer(as I know,
difference in codes for single and multiple security is minimal, only
"Tally" lines)
========
{ This is the `LONG' trading part of the recording process }
LongEntryTrigger := Cross(MACD(),Mov(MACD(),41,E));
LongEntryPrice := CLOSE;
LongExitTrigger := Cross(Mov(MACD(),41,E),MACD());
LongExitPrice := CLOSE;
LongInitialStop := LongEntryPrice * 0.9; { Optional initial stop }
ExtFml( "TradeSim.Initialize"); { Initialize internal variables }
ExtFml( "TradeSim.SetProfitStop", 20 );
ExtFml( "TradeSim.SetExitPriceToProfitStop");
ExtFml("TradeSim.EnableProtectiveStop",0);
ExtFml( "TradeSim.SetExitPriceToInitialStop");
Tally:=ExtFml( "TradeSim.RecordTrades",
"MACD2 Long and Short example", { Trade Data Filename }
LONG, { Trade Position Type }
LongEntryTrigger, { Entry Trigger }
LongEntryPrice, { Entry Price }
LongInitialStop, { Initial Stop }
LongExitTrigger, { Exit Trigger }
LongExitPrice, { Exit Price }
START); { Trade Recorder Control }
{ This is the `SHORT' trading part of the recording process }
ShortEntryTrigger := Cross(Mov(MACD(),41,E),MACD());
ShortEntryPrice := CLOSE;
ShortExitTrigger := Cross(MACD(),Mov(MACD(),41,E));
ShortExitPrice := CLOSE;
ShortInitialStop := ShortEntryPrice * 1.1; { Optional initial stop }
ExtFml( "TradeSim.SetProfitStop", 20 );
ExtFml( "TradeSim.SetExitPriceToProfitStop");
ExtFml("TradeSim.EnableProtectiveStop",0);
ExtFml( "TradeSim.SetExitPriceToInitialStop");
Tally:=Tally + ExtFml( "TradeSim.RecordTrades",
"", { Trade Data Filename }
SHORT, { Trade Position Type }
ShortEntryTrigger, { Entry Trigger }
ShortEntryPrice, { Entry Price }
ShortInitialStop, { Initial Stop }
ShortExitTrigger, { Exit Trigger }
ShortExitPrice, { Exit Price }
CONTINUE); { Trade Recorder Control }
Tally; { adding this line will display the correct number of trades
written to the trade database }
========
An analogous trade system in MetaStock System Tester
========
Enter Long = Close Short = Cross(MACD(),Mov(MACD(),41,E))
Enter Short = Close Long = Cross(Mov(MACD(),41,E),MACD())
Max Loss = 10% for Long and Short with Exit at Stop Price; Profit
Target = 20% for Long and Short with Exit at Stop Price; Trailing Stop
= 20 % of profit risk with Exit at StopPrice, periods(of inactivity)
is 2.
========
Profitable trades to all:)
Beforehand a lots of thank.
--- In equismetastock@xxxxxxxxxxxxxxx, "Jose Silva" <josesilva22@xxxx>
wrote:
> 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 --------------------~-->
Help tsunami villages rebuild at GlobalGiving. The real work starts now.
http://us.click.yahoo.com/njNroD/KbOLAA/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/
|