logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
zigzag  
#1 Posted : Monday, June 8, 2009 2:35:33 PM(UTC)
zigzag

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 1/13/2009(UTC)
Posts: 42

Would anybody be interested in taking a crack at this system? it seems very promising based on some testing i saw in an article...

I came across a system called Pullback that has the following trading rules (assume today T):

A. LE setup and rule

A1. two previous closes (at bars T-2 and T-1) must have been two consecutive lower closes and

A2. H of bar at T must be higher than H at T-1 and

A3. close of bar at T must be higher than the 50-period EMA of closes for bar T

A4. buy at next open if A1 and A2 and A3 are all true

B. LX

B1. sell at next open when position shows a profit at close

B2. sell at a loss if the L falls below lowest low of the last two bars

C. Position Size

number of shares to trade = 4% * available equity / (entry price-stop-loss price [item B2 above])

This is my attempt to code it in MS's EST:

BUY:

LEsetup1:=ref(c,-2)<ref(c,-3) and ref(c,-1)<rf(c,-2);

LEsetup2:=h>ref(h,-1);

LEsetup3:=c>mov(c,50,e);

LE:=LEsetup1=1 and LEsetup2=1 and LEsetup3=1;

ref(LE=1,-1)

SELL:

LXsetup1:=valuewhen(1,LE,ref(o,1))-c>0;

LXsetup2:=l<(llv(l,2),-1);

LX:=LXsetup1=1 or LXsetup2=1;

ref(LX,-1)

NOT SURE HOW TO CODE "availbale equity" but the basic equation for position size is:

number of shares to trade = 4% * available equity / (valuewhen(1,LE,ref(o,1))-ref(llv(l,2),-1))

johnl  
#2 Posted : Monday, June 8, 2009 9:57:05 PM(UTC)
johnl

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 11/7/2005(UTC)
Posts: 602

Here is my first shot. Looks Ok. Color the spike yellow, that's the signal, The next is the profit
potential. Looks like you can go long any time profit curve crosses to positive.


a1:=(C<Ref(C,-1))*(Ref(C,-1)<Ref(C,-2));
a2:=(H>Ref(H,-1));
a3:=(C>Mov(C,50,E));
a4:=a1*a2*a3;
a5:=Ref(a4,-1)*O;
{----------------------------------------}
b1:=ValueWhen(1,(a5>0),O);
b2:=If(Ref(C-b1,-1)>0,O-b1,0);
b3:=If((L<Ref(L,-1))*(L<Ref(L,-2)),C-b1,0);
{----------------------------------------}
b4:=b2*(BarsSince(b3<>0)>BarsSince(b1>0));
b5:=b3*(BarsSince(b2<>0)>BarsSince(b1>0));
{----------------------------------------}
If((a5>0),-(C/10),0);
b2;
wabbit  
#3 Posted : Tuesday, June 9, 2009 11:30:51 AM(UTC)
wabbit

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers, Unverified Users
Joined: 10/28/2004(UTC)
Posts: 3,111
Location: Perth, Western Australia

Was thanked: 16 time(s) in 16 post(s)
Here's my first grab at the test code:

Code:

 System Details
 ZigZag
 OptimizedNo
 Order BiasLong
 Portfolio BiasSingle
 Position Limit1

 Notes
 Equis Forum : http://forum.equis.com/forums/thread/29879.aspx

 
 Buy Order
 Order TypeMarket
 Order ExpirationGood Until Cancelled
 Entry Size Method# Of Units
 
 Signal Formula
 ref(c,-2)<ref(c,-3) and ref(c,-1)<ref(c,-2) and h>ref(h,-1) and 
 c>mov(c,50,e); 
 
 Price Formula

 
 Entry Size Formula
 p1:=int(Simulation.AccountLongFundsAvailable * 0.04 * (Ref(OPEN,+1) 
 - Ref(LLV(L,2),+1))); p2:=int(Simulation.AccountLongFundsAvailable / 
 Ref(OPEN,+1)); min(p1,p2);
 
 Strategic Delays
 # Bars on Tick Data0
 # Bars on Minute Data0
 # Bars on Daily Data0
 Sell Short Order
 Order TypeMarket
 Order ExpirationGood Until Cancelled
 Entry Size MethodUse Default Size
 
 Signal Formula

 
 Price Formula

 
 Entry Size Formula
 100
 
 Strategic Delays
 # Bars on Tick Data0
 # Bars on Minute Data0
 # Bars on Daily Data0

 
 Sell Order
 Order TypeMarket
 Order ExpirationGood Until Cancelled
 
 Signal Formula
 CLOSE > extfml("forum.ref", OPEN,Simulation.CurrentPositionAge) OR L 
 < Ref(LLV(L,2),-1)
 
 Price Formula

 
 Strategic Delays
 # Bars on Tick Data0
 # Bars on Minute Data0
 # Bars on Daily Data0
 Buy to Cover Order
 Order TypeMarket
 Order ExpirationGood Until Cancelled
 
 Signal Formula

 
 Price Formula

 
 Strategic Delays
 # Bars on Tick Data0
 # Bars on Minute Data0
 # Bars on Daily Data0

 
 Stops
 BreakEven Stop
 PositionsNone
 Floor Level0.00 %
 Stop Loss
 PositionsNone
 Stop Value0.00 %

 Trailing Stop
 PositionsNone
 Profit Risk Value0.00 %
 Trailing Periods0.0
 Inactivity Stop
 PositionsNone
 Minimum Value0.00 %
 Periods0.0

 Profit Target
 PositionsNone
 Target Value0.00 %


 
 Simulation Options

 General Options
 Points Only TestNo
 Initial Equity100000.
 Default Size10.00 % Of Available Equity
 Trade LongYes
 Trade ShortYes
 Optimization Results50

 Trade Execution Options
 Realistic Market PricesNo
 Buy PriceOpen
 Sell PriceOpen
 Sell Short PriceOpen
 Buy To Cover PriceOpen
 Delay To Open1
 
 Slippage
 Buy0.00 %
 Sell0.00 %
 Sell Short0.00 %
 Buy to Cover0.00 %
 Broker Options
 Interest Rates
 Margin0.00 %
 Money Market0.00 %
 
 Margin Requirement
 Long Initial100.00 %
 Long Maintenance0.00 %
 
 Short Initial150.00 %
 Short Maintenance150.00 %
 
 Commissions
 Entry$0.00 Per Transaction
 Exit$0.00 Per Transaction




Hope this helps.

wabbit [:D]

zigzag  
#4 Posted : Thursday, June 11, 2009 2:33:25 PM(UTC)
zigzag

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 1/13/2009(UTC)
Posts: 42

johnl and Wabbit

Thanks for you thoughts and codes. Wabbit, I have optimized for the EMA period (prd=2) and backtested your code on daily SPY going back to 01/97, with the following changes:

1. delay to open 0

2. $10/trade

3. 100% of available equity position size

4. margin requirements 100%, 0%, 200% and 101%

5. broker margin 3%, interest 0%

Also, I think that

p1:=int(Simulation.AccountLongFundsAvailable * 0.04 * (Ref(OPEN,+1)-Ref(LLV(L,2),+1)))

should read

p1:=int(Simulation.AccountLongFundsAvailable * 0.04 / (Ref(OPEN,+1)-Ref(LLV(L,2),+1)))

no?

Results show a system with a lot more winners than losers but average profit is just about 60% of average loss. Despite upward sloping and extremely smooth equity curve and a lot of days out of the market, final equity is just a tad over 2x initial equity. I wouldn't call it a winner but it might warrant some further research and tweaking.

Many thanks for your help.

ZigZag

Users browsing this topic
Guest (Hidden)
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.