Error

 Previous Topic Next Topic
 SixPak #1 Posted : Monday, April 4, 2005 5:54:10 AM(UTC) Rank: NewbieGroups: Registered, Registered UsersJoined: 4/4/2005(UTC)Posts: 6 Hello! I need help on how to write an Expert that has a 20 day moving average plotted along with a 15 day moving average of the first 20 day moving average. Can anybody help me with this? I'm able to plot the two moving averages but I'd like to use them in a system tester and expert and can't figure out how to do it. Dave
 Wanna join the discussion?! Login to your Discussions forum accountor Register a new forum account.
 hayseed #2 Posted : Monday, April 4, 2005 10:00:46 AM(UTC) Rank: Advanced MemberGroups: Registered, Registered Users, SubscribersJoined: 3/7/2005(UTC)Posts: 1,346 hey sixpack..... metastock coding is not my forte, yet, but here might be a solution....... this indicator plots 1 when 20 is above the 15 and plots a -1 when 15 is above the 20.... change the 'E' to s for simple ma's MASwitch:=If(Mov(( Mov(C, 20, E)),15,E)Mov(C,20,E),-1,0)); If(BarsSince(MASwitch=1) Mov(C,20,E)) ---------------------------------------------------------- system tester buy order=(Mov(( Mov(C, 20, E)),15,E)Mov(C,20,E)) sell short order=(Mov(( Mov(C, 20, E)),15,E)>Mov(C,20,E)) buy to cover=(Mov(( Mov(C, 20, E)),15,E)
 hayseed #3 Posted : Monday, April 4, 2005 11:49:35 AM(UTC) Rank: Advanced MemberGroups: Registered, Registered Users, SubscribersJoined: 3/7/2005(UTC)Posts: 1,346 another thought here.... when its known exactly what is needed, purpose built code can be used..... however its often interesting to fiddle with the numbers without rewriting..... there, using the 'periods' referencing function in meta makes that investigation more enjoyable..... to see just copy, paste and fiddle below......h Periods1:=Input("ema",1,252,20); Periods2:=Input("ema of period 1",2,1008,15); MASwitch:=If(Mov(( Mov(C, periods1, E)), periods2,E)Mov(C,periods1,E),-1,0)); If(BarsSince(MASwitch=1)
 hayseed #4 Posted : Monday, April 4, 2005 12:55:46 PM(UTC) Rank: Advanced MemberGroups: Registered, Registered Users, SubscribersJoined: 3/7/2005(UTC)Posts: 1,346 perhaps a better coder can take a look at what i provided.... it still appears redundant or excessive in length...... here might be a valid exploration for sixpack's indicator..... place in the filter section of explorer and it returns only the 'true' in column 1......h explorer filter Mov(( Mov(C, 20, E)),15,E)
 Patrick #5 Posted : Monday, April 4, 2005 4:02:30 PM(UTC) Rank: Advanced MemberGroups: Registered, Registered Users, SubscribersJoined: 9/8/2004(UTC)Posts: 2,266Was thanked: 1 time(s) in 1 post(s) Thanks Hayseed, your formula is fine. My only comment here is that I would write the formula like this : for a buy let's say : MA1:=Mov(C,20,S); MA2:=Mov(MA1,15,S); Cross(MA1,MA2) It makes easier to adjust the values, and more often than not you want to use the cross function rather than > . Patrick
 SixPak #6 Posted : Tuesday, April 5, 2005 2:26:22 AM(UTC) Rank: NewbieGroups: Registered, Registered UsersJoined: 4/4/2005(UTC)Posts: 6 hayseed wrote:hey sixpack..... metastock coding is not my forte, yet, but here might be a solution....... this indicator plots 1 when 20 is above the 15 and plots a -1 when 15 is above the 20.... change the 'E' to s for simple ma's MASwitch:=If(Mov(( Mov(C, 20, E)),15,E)Mov(C,20,E),-1,0)); If(BarsSince(MASwitch=1) Mov(C,20,E)) ---------------------------------------------------------- system tester buy order=(Mov(( Mov(C, 20, E)),15,E)Mov(C,20,E)) sell short order=(Mov(( Mov(C, 20, E)),15,E)>Mov(C,20,E)) buy to cover=(Mov(( Mov(C, 20, E)),15,E)
 SixPak #7 Posted : Tuesday, April 5, 2005 3:34:58 AM(UTC) Rank: NewbieGroups: Registered, Registered UsersJoined: 4/4/2005(UTC)Posts: 6 Patrick wrote:Thanks Hayseed, your formula is fine. My only comment here is that I would write the formula like this : for a buy let's say : MA1:=Mov(C,20,S); MA2:=Mov(MA1,15,S); Cross(MA1,MA2) It makes easier to adjust the values, and more often than not you want to use the cross function rather than > . Patrick Thanks for the reply Patrick. I'm not sure what to do with those formulae. Do I enter that for "bullish" in an expert just like you have it there? Dave
 SixPak #8 Posted : Tuesday, April 5, 2005 6:22:08 AM(UTC) Rank: NewbieGroups: Registered, Registered UsersJoined: 4/4/2005(UTC)Posts: 6 With your help (Hayseed), I managed to figure out what I needed to do to create the System Test I was looking for. Here's what I used as my "Buy" signal: (Mov(( Mov(C, opt1, E)),opt2,S)
 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.