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 : Tuesday, January 13, 2009 2:46:50 PM(UTC)
zigzag

Rank: Advanced Member

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

I have re-registered onto EIOC because I forgot the password to my old sign-in name (whiplash) and the password retrieval feature of EIOC is not working... so, hello again.

Over the holidays, I had some free time and took a swing at writing a test code for the RMO trading system as suggested by Equis' webinar (below).

When I run this backtest on SPY (daily, from jan93 to present), MS generates no trade signals. I am sure there is something wrong with my coding and/or the test settings but I can't seem to figure it out.

Would anybody like to take a peek?

Many thanks and I hope that we may all benefit from this code once it's functional.

ZigZag

Code:

event1:=Fml( "Rahul Mohindar Osc (RMO)")>0 AND Fml( "SwingTrd 2")>Fml( "SwingTrd 3") AND Fml( "SwingTrd 2")>0; {all three indicators above zero}

event2:=H>ValueWhen(1,event1,H)*1.001; {current bar High 0.1% above the High of the bar when the latest event1 happened}

event3:=Fml( "Rahul Mohindar Osc (RMO)")<0 AND Fml( "SwingTrd 2")<Fml( "SwingTrd 3") AND Fml( "SwingTrd 2")<0; {all three indicators below zero}

event4:=L<ValueWhen(1,event3,L)*0.999; {current bar Low 0.1% below the Low of the bar when the latest event3 happened}

event5:=Fml( "Rahul Mohindar Osc (RMO)")<0 OR Fml( "SwingTrd 2")<Fml( "SwingTrd 3") OR Fml( "SwingTrd 2")<0; {any of the three indicators below zero}

event6:=L<min(ValueWhen(1,event1,L)*0.999,Ref(ValueWhen(1,event5,L),-1)*0.999); {current bar Low below the lowest of: 1) 0.1% below the Low of the bar when the latest event1 happened and 2) 0.1% below the Low of the bar immediately previous to the bar when the latest event5 happened.}

event7:=Fml( "Rahul Mohindar Osc (RMO)")>0 OR Fml( "SwingTrd 2")>Fml( "SwingTrd 3") OR Fml( "SwingTrd 2")>0; {any of the three indicators above zero}

event8:=H>max(ValueWhen(1,event3,H)*1.001, Ref(ValueWhen(1,event7,H),-1)*1.001); {current bar High above the highest of: 1) 0.1% above the High of the bar when the latest event3 happened and 2) 0.1% above the High of the bar immediately previous to the bar when the latest event7 happened.}

BUY at next bar open: event1 and event2

Stop Price: ValueWhen(1,event1,H)*1.001 {0.1% above the High of the bar when the latest event1 happened}

Entry Size: 5% of available equity

SELL SHORT at next bar open: event3 and event4

Stop Price: ValueWhen(1,event3,L)*0.999 {0.1% below the Low of the bar when the latest event3 happened}

Entry size: 5% of available equity

SELL at next bar open: event5 or event6

Stop Price: ValueWhen(1,event5,L)*0.999 {0.1% below the Low of the bar when the latest event5 happened}

BUY TO COVER at next bar open: event7 or event8

Stop Price: ValueWhen(1,event7,H)*1.001 {0.1% above the High of the bar when the latest event7 happened}

Other settings:

1. Limit number of simultaneous positions to 20

2. Initial equity: 100,000

3. Commissions: 10 points ($) per transaction, entry and exit

4. Margin requirements: Long Initial 100%, Long Maintenance 0%, Short Initial 200%, Short Maintenance 101%

5. Trade Execution: Realistic Market Prices, Slippage 0

minnamor  
#2 Posted : Wednesday, January 14, 2009 12:08:19 AM(UTC)
minnamor

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 4/27/2005(UTC)
Posts: 126
Location: Italy

this works for me (omit pivot point values if you do not own Power Pivots add-on):

Common to all 4 sections:

cond1:=If(Fml("_RMO SwingTrd 2")>Fml("_RMO SwingTrd 3"),1,If(Fml("_RMO SwingTrd 3")>Fml("_RMO SwingTrd 2"),-1,0));
cond2:=if(FmlVar("_RMO Rahul Mohindar Osc","RMO") > 0,1,-1);
cond3:=if(Fml("_RMO SwingTrd 2")>0,1,-1);
setup:= (cond1+cond2+cond3);
LE:= setup=3 and ref(setup,-1)<3;
SE:= setup=-3 and ref(setup,-1)>-3;
LX:= Cross(ExtFml("PowerPivots.NthPivotPrice",-1,0,1),l) or cross(valuewhen(1,le,LLV(L,2)),l);
SX:= Cross(h, ExtFml("PowerPivots.NthPivotPrice",1,0,1)) or cross(h,valuewhen(1,se,hhV(h,2)));

additional (last) line in:

Buy Order: alert(ref(le,-1),3) and h>valuewhen(1,le,h)

Sell Order: LX

Sell Short Order: alert(ref(se,-1),3) and L<valuewhen(1,se,L)

Buy to Cover Order: SX

Stop orders are as follows:

Buy Order:

cond1:=If(Fml("_RMO SwingTrd 2")>Fml("_RMO SwingTrd 3"),1,If(Fml("_RMO SwingTrd 3")>Fml("_RMO SwingTrd 2"),-1,0));
cond2:=if(FmlVar("_RMO Rahul Mohindar Osc","RMO") > 0,1,-1);
cond3:=if(Fml("_RMO SwingTrd 2")>0,1,-1);
setup:= (cond1+cond2+cond3);
LE:= setup=3 and ref(setup,-1)<3;
SE:= setup=-3 and ref(setup,-1)>-3;
LX:= Cross(ExtFml("PowerPivots.NthPivotPrice",-1,0,1),l) or cross(valuewhen(1,le,LLV(L,2)),l);
SX:= Cross(h, ExtFml("PowerPivots.NthPivotPrice",1,0,1)) or cross(h,valuewhen(1,se,hhV(h,2)));
max(O,valuewhen(1,le,h))

Sell Order:

cond1:=If(Fml("_RMO SwingTrd 2")>Fml("_RMO SwingTrd 3"),1,If(Fml("_RMO SwingTrd 3")>Fml("_RMO SwingTrd 2"),-1,0));
cond2:=if(FmlVar("_RMO Rahul Mohindar Osc","RMO") > 0,1,-1);
cond3:=if(Fml("_RMO SwingTrd 2")>0,1,-1);
setup:= (cond1+cond2+cond3);
LE:= setup=3 and ref(setup,-1)<3;
min(O,If(Cross(ExtFml("PowerPivots.NthPivotPrice",-1,0,1),l),ExtFml("PowerPivots.NthPivotPrice",-1,0,1),valuewhen(1,le,LLV(L,2))))

Sell Short Order:

cond1:=If(Fml("_RMO SwingTrd 2")>Fml("_RMO SwingTrd 3"),1,If(Fml("_RMO SwingTrd 3")>Fml("_RMO SwingTrd 2"),-1,0));
cond2:=if(FmlVar("_RMO Rahul Mohindar Osc","RMO") > 0,1,-1);
cond3:=if(Fml("_RMO SwingTrd 2")>0,1,-1);
setup:= (cond1+cond2+cond3);
LE:= setup=3 and ref(setup,-1)<3;
SE:= setup=-3 and ref(setup,-1)>-3;
LX:= Cross(ExtFml("PowerPivots.NthPivotPrice",-1,0,1),l) or cross(valuewhen(1,le,LLV(L,2)),l);
SX:= Cross(h, ExtFml("PowerPivots.NthPivotPrice",1,0,1)) or cross(h,valuewhen(1,se,hhV(h,2)));
min(O,valuewhen(1,se,L))

Buy to Cover Order:

cond1:=If(Fml("_RMO SwingTrd 2")>Fml("_RMO SwingTrd 3"),1,If(Fml("_RMO SwingTrd 3")>Fml("_RMO SwingTrd 2"),-1,0));
cond2:=if(FmlVar("_RMO Rahul Mohindar Osc","RMO") > 0,1,-1);
cond3:=if(Fml("_RMO SwingTrd 2")>0,1,-1);
setup:= (cond1+cond2+cond3);
SE:= setup=-3 and ref(setup,-1)>-3;
min(O,If( Cross(h, ExtFml("PowerPivots.NthPivotPrice",1,0,1)),ExtFml("PowerPivots.NthPivotPrice",1,0,1), valuewhen(1,se,hhV(h,2))))

Hope this helps.

zigzag  
#3 Posted : Wednesday, January 14, 2009 8:31:30 AM(UTC)
zigzag

Rank: Advanced Member

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

Minnamor, i just saw your posting. many thanks. it is v generous of you to share it with the community. one question: is your code setting up for exiting longs when swingtrd2<swingtrd3 OR swingtrd2<0 OR RMO<0? likewise, is your code setting up for exiting shorts when swingtrd2>swingtrd3 OR swingtrd2>0 OR RMO>0? these are the LX and SX set-ups suggested by Equis.

Thanks again.

ZigZag

minnamor  
#4 Posted : Wednesday, January 14, 2009 9:02:06 PM(UTC)
minnamor

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 4/27/2005(UTC)
Posts: 126
Location: Italy

The answer to your question is found by looking at "setup" definition and its constituents, i.e. conditions 1 to 3.
zigzag  
#5 Posted : Thursday, January 15, 2009 7:21:08 AM(UTC)
zigzag

Rank: Advanced Member

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

understood. many thanks.

one quick note: shouldn't "min" read "max" on the line below from your Buy to Cover stop price code?

min(O,If( Cross(h, ExtFml("PowerPivots.NthPivotPrice",1,0,1)),ExtFml("PowerPivots.NthPivotPrice",1,0,1), valuewhen(1,se,hhV(h,2))))

also, how would you describe in plain english the code line above (ignoring the powerpivots...)?

best

ZigZag

minnamor  
#6 Posted : Thursday, January 15, 2009 10:57:51 PM(UTC)
minnamor

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 4/27/2005(UTC)
Posts: 126
Location: Italy

well spotted. Apologies for oversight.
simos  
#7 Posted : Monday, September 27, 2010 5:29:58 AM(UTC)
simos

Rank: Member

Groups: Registered, Registered Users
Joined: 1/7/2010(UTC)
Posts: 11
Location: Greece

Hi Minnamor, I'm from Greece.

I saw your work for the RMO EST , and I have a question..

I can't find : the Fml("_RMO SwingTrd 1")-2-3, the (FmlVar("_RMO Rahul Mohindar Osc","RMO")and the ExtFml Power pivots that you have used.
Any assistance?

Ciao
henry1224  
#8 Posted : Tuesday, September 28, 2010 5:20:21 PM(UTC)
henry1224

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 10/29/2004(UTC)
Posts: 1,394
Location: Glastonbury, CT

Was thanked: 2 time(s) in 2 post(s)
Simon,to use the ExtFml Power pivots,you will need to purchase the powerpivot plus add-on
simos  
#9 Posted : Thursday, September 30, 2010 1:25:12 AM(UTC)
simos

Rank: Member

Groups: Registered, Registered Users
Joined: 1/7/2010(UTC)
Posts: 11
Location: Greece

Hi Henry,

thank you for your response

Do you know how can I create an System Tester for the RMO method?
Users browsing this topic
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.