Hi John
I haven't tried using same-bar signals in TradeSim
so I can't comment on whether that works or not. It should be simple enough to
test though. From your comments it seems that "latching" your
signals might not be the problem so much as "executing"
them.
Both the Enhanced System Tester and my Trade Equity
tools manage same-bar trades (intraday on EOD bars or intraweek on weekly bars).
If trading prices other than OPEN and CLOSE on the same weekly bar there's a
distinct possibility that EOD prices making up that bar might not
support such trades, such as when the weekly bar includes an EOD gap up or
down.
The EST will accept intrabar prices when the buy
signal is forward referenced by one bar (into the future) so that the buy is
perceived as being "considered" (one of the four EST trade stages) one bar
before the sell signal. Obviously one cannot buy tomorrow in real life, and so
the forward referenced signal must then have a one bar Strategic delay applied
so that the buy signal is "executed" on the correct bar. A buy and sell on
the same bar will be rejected by the EST if those signals are both considered to
take place on the same bar. The advance/delay shuffle of the buy signal tricks
the EST into treating the buy and sell as applying to different
bars.
When the EST uses prices other than OHLC those
prices must be signalled in the relevant price window at the time of the
binary buy or sell signal. Trade Equity uses either binary signals and OHLC
prices for buy and sell, or "stop" prices where the buy or sell signal also
carries the price. Stop prices can only be applied to the bar that they're
intended for because there's no guarantee that the H/L range of any subsequent
bar would straddle that stop price signal.
Below are two price indicators and the Trade
Equity GV LE indicator (GV DLL assisted, Long, equal position sizing). When
plotted on an EOD or weekly chart, a buy on the OPEN and sell on the CLOSE will
be executed on any bar dated the 15th. A brief description follows for the
various TE user options.
"I" variable (TE Display Option) the default option
simulates an MS 7.X equity curve. The TE display module is another indicator
that must be linked to TE to enable other display selections.
"B" selects a buy price form OHLC or
Stop
"Z" selects a sell price form OHLC or
Stop
"A" supplies a factor by which the
following costs values can be divided. This allows seeling costs to range
from $999 down to $0.00, or 0.0001 for a 1 pip spread for example.
"Cn" allows 3 digits each for buy and sell costs
(commissions, slippage or spread)
"Nd" allows 1 digits each for buy and
sell delays (disabled when using stop prices)
"Cp" sets the amount of capital used per
trade
"F" is a modifier for "Cp" which can be hard coded,
or supplied by an external formula to override "Cp" and set the number of
shares to be purchased (for example).
"N" is the entry point for an external binary buy
formula
"Ns" is the entry point for an external price
stop buy formula
"X" is the entry point for an external binary sell
formula
"Xs" is the entry point for an external price
stop sell formula
{Sample Price Buy
Stop}
If(DayofMonth()=15,OPEN,0);
{Sample Price Sell
Stop}
If(DayofMonth()=15,CLOSE,0);
{Trade Equity GV
LE}{V7} {2003-2008, Roy Larsen} I:=Input("TE Display Option
0-22",0,22,0); B:=Input("Buy 1=O 2=C 3=H 4=L
5=Stop",1,5,5); Z:=Input("Sell 1=O 2=C 3=H 4=L
5=Stop",1,5,5); A:=Input("Cost Divisor, 1-10000
[0-4]",0,4,0); Cn:=Input("In/Out
Cost/Pips",0,999999,000000); Nd:=Input("In/Out
Delays",0,55,00); Cp:=10000;{size} F:=-1;{Cp factor} N:=
0; Ns:=Fml("Sample Price Buy Stop"); X:= 0; Xs:=Fml("Sample Price Sell
Stop"); {end user area}
I:=ExtFml("GV.SetVar","Le",I);Ns:=(B=5)*Ns; A:=If(A>3,10000,If(A>2,1000,If(A>1,100,If(A>0,10,1)))); Xd:=LastValue(Int(Frac(Nd/9.9)*10)); Nd:=LastValue(Int(Nd/10)); F:=ValueWhen(1+Nd,1,If(F=0,-1,If(Abs(F)>1,Abs(F),-F))); Cx:=(Cn-1000*Int(Cn/1000))/A;Cn:=Int(Cn/1000)/A; M:=If(Ns>0,Min(H,Max(L,Ns)),If(B=1,O,If(B=3,H,If(B=4,L,C)))); N:=N
AND Alert(N=0,2)+(Cum(N>-1)=1); X:=X AND
(Z<5)*(Alert(X=0,2)+(Cum(N>-1)=1)); N:=ValueWhen(1+Nd,1,N);N:=If(B<5,N,Ns>0); Y:=If(Xs>0,Min(H,Max(L,Xs)),If(Z=1,O,If(Z=3,H,If(Z=4,L,C)))); X:=ValueWhen(1+Xd,1,X);X:=X+Xs>0; Y:=If((Z<5)*(X=0),C,Y); Y:=If((Xs>0)*N*X,Xs,Y); I:=Cum(Abs(F)+N+X>-2)=1;N:=(I>-1)*N; Y:=If((N+X=0)*Alert(N*X,2),ValueWhen(2,1,Y),Y); Tr:=BarsSince(I+N)<(BarsSince(I+X)+(Cum(N)=1
AND
Cum(I+X)=1)); Tr:=If((N+X>1)*(Alert(Tr,2)+((Nd+Xd<1)*(B<>2)*(Z>1)*(Max(B,Z)>4
OR
B<>Z))),1,Tr); En:=(Tr+Alert(Tr=0,2)=2)+I; Ex:=(Tr=0)*Alert(Tr,2);M:=If(I*(N=0),C,M); Lb:=Alert(Tr,2)*(LastValue(Cum(1))=Cum(1)); {Ex:=Ex
OR
Lb}; A:=ValueWhen(1,En,If(M=0,1,M)); F:=ValueWhen(1,En,If(F<0,Cp*Abs(F),If(F<=1,Int((F*Cp-Cn)/A)*A+Cn,F*A+Cn)))*(Cp>0); En:=Tr*(Alert(Tr=0,2)+I>0); N:=(Ex+Lb>0)*If(Cp=0,Y-A-Cx,(F-Cn)*(Y/A)-F-Ex*Cx); B:=Alert(Tr,2)*(1+BarsSince(En+I)); Xs:=Alert(Tr,2)*If(Cp=0,Y-A,(F-Cn)*(Y/A)-F-Ex*Cx); Nd:=LowestSince(1,I,Xs);Ns:=HighestSince(1,I,Xs); X:=Cum((Ex+Lb>0)*(N>0)*B);Xd:=Cum((Ex+Lb>0)*(N<=0)*B); M:=Cum(N)+Cp+Tr*(Lb=0)*If(Cp=0,Y-A-Cx,(F-Cn)*(Y/A)-F); I:=ExtFml("GV.SetVar","I",I);I:=ExtFml("GV.SetVar","N",N); I:=ExtFml("GV.SetVar","X",X);I:=ExtFml("GV.SetVar","Cn",Cn); I:=ExtFml("GV.SetVar","Cp",Cp);I:=ExtFml("GV.SetVar","Cx",Cx); I:=ExtFml("GV.SetVar","En",En);I:=ExtFml("GV.SetVar","Ex",Ex); I:=ExtFml("GV.SetVar","Lb",Lb);I:=ExtFml("GV.SetVar","Nd",Nd); I:=ExtFml("GV.SetVar","Ns",Ns);I:=ExtFml("GV.SetVar","Tr",Tr); I:=ExtFml("GV.SetVar","Xd",Xd);I:=ExtFml("GV.SetVar","Xs",Xs); I:=ExtFml("GV.SetVar","F",F);I:=ExtFml("GV.SetVar","Eq",M); {Fml("Trade Equity LE Display");}M;
All Trade Equity tools are free and most are
available from my website or from me directly. Hope this
helps.
Regards
Roy
----- Original Message -----
Sent: Monday, May 12, 2008 6:31 PM
Subject: [EquisMetaStock Group] Latch or
Clean Signals Help Please
Hi, I trade using the weekly bars and I've been toying with the idea of
running a weekly update at (say) thirty minutes before Friday closing
using live market data and if an exit signal is flagged there would be
time to execute an exit in the last 30 minutes before the close for the
week. I want to simulate (using Tradesim) if there is a benefit in
doing this or if I should just exit on Monday open as normal. My
specific problem is how to generate clean signals (or a latch) because
there is potentially an entry and an exit on the same (weekly) bar caused
by an entry on open based on a prior week signal and an exit on close
based on the current week signal. The forum.dll and Jose's Trade Signals
v4.0 (I asked Jose but he is snowed under with overdue contracted work)
don't handle an entry and an exit on the same bar. Is there some way to
plot a latch or clean signals (or two sets of latches or signals working
in tandem)even if an exit is flagged on the same bar as the
entry? John
__________ NOD32 3093 (20080512)
Information __________
This message was checked by NOD32 antivirus
system. http://www.eset.com
__._,_.___
__,_._,___
|