Rank: Advanced Member
Groups: Registered, Registered Users Joined: 4/27/2005(UTC) Posts: 126 Location: Italy
|
The well known BowTie setup introduces by David Landry in discussed in http://www.tradingmarkets.com/.site/stocks/education/chrtpats/08092000-7762.cfm (TradingMarkets) where the setup is described as follows: Using a 10-period simple, 20-period exponential and a 30-period exponential moving average: - The moving averages should converge and spread out again giving the appearance of a bow tie. At this juncture, the moving averages should be in proper uptrend order, that is, the 10-SMA > 20-EMA > 30-EMA. - The market must make a low less than the prior day’s low. - Place a buy order above the high of bar described in (2.). - If not filled, continue to work a buy order above the prior day’s high until either filled or the low trades below the 20-EMA. - Once filled, place an initial protective stop below low of (2). - Trail your stops until stopped out and/or exit in two to six days.
I have tried to translate the above in Metastock code as follows (the time stop is handled in "System Editor", "Stops", "Inactivity Minimum Change"):
Buy0:= Alert(Cross(Mov(C,10,S),Mov(C,20,E)),3) AND Alert(Cross(Mov(C,20,E),Mov(C,30,E)),3) AND Alert(Cross(Mov(C,10,S),Mov(C,30,E)),3); Sell0:= Alert(Cross(Mov(C,30,E),Mov(C,10,S)),3) AND Alert(Cross(Mov(C,30,E),Mov(C,20,E)),3) AND Alert(Cross(Mov(C,20,E),Mov(C,10,S)),3); I0:=Cum(Buy0 + Sell0 > -1) = 1; Tr0:=If(BarsSince(Buy0 OR I0) < BarsSince(Sell0 OR I0),1,-1); Buy1:= tr0=1 and L<ref(l,-1) and L>mov(c,20,e); Sell1:= tr0=-1 and H>ref(h,-1) and L<mov(c,20,e); I1:=Cum(Buy1 + Sell1 > -1) = 1; Tr1:=If(BarsSince(Buy1 OR I1) < BarsSince(Sell1 OR I1),1,-1); LE:= Tr0=1 and Tr1=1 AND Mov(C,10,S)>Mov(C,20,E) AND Mov(C,20,E)>Mov(C,30,E); SE:= Tr0=-1 and Tr1=-1 AND Mov(C,10,S)<Mov(C,20,E) AND Mov(C,20,E)<Mov(C,30,E); LX:= Cross(Ref(LLV(L,2),1),l); SX:= Cross(h,Ref(HHV(H,2),-1));
Appropriate stop orders have been entered. Any views and comments on the above code would be much appreciated. Thanks.
|