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

Notification

Icon
Error

Options
Go to last post Go to first unread
opensource  
#1 Posted : Sunday, March 1, 2009 7:17:28 AM(UTC)
opensource

Rank: Member

Groups: Registered, Registered Users, Subscribers
Joined: 1/27/2009(UTC)
Posts: 11

I found a systems backtesting formula on a Website. How do you covert that formula so that it could work as an indicator, an explorer, or a expert advisor? Thanks.
johnl  
#2 Posted : Sunday, March 1, 2009 7:19:04 PM(UTC)
johnl

Rank: Advanced Member

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


What language is it in? Depends on how involved the code is. You have to convert
the code you have into English verbiage and then from that into Metastock code.
opensource  
#3 Posted : Monday, March 2, 2009 4:09:12 AM(UTC)
opensource

Rank: Member

Groups: Registered, Registered Users, Subscribers
Joined: 1/27/2009(UTC)
Posts: 11

Below is a code of the system tester called Bianchi Approach. I am trying to convert this to an Explorer or an expert advisor. Any help is appreciated. Thanks. Enter Long: When(Mov( Mid(C,opt1),opt1,E), > ,Mov(Mid(C,opt1),opt2,E)) AND When(Ref(Mov(Mid(C,opt1),opt1,E),-1), <= ,(Ref(Mov((Mid(C,opt1)),opt2,E),-1))) AND When(Mov(Abs((Mo(opt3))),opt4,E), > ,Ref(Mov(Abs((Mo(opt3))),opt4,E),-1)) Enter Short: When(Mov( Mid(C,opt1),opt1,E) , < ,Mov(Mid(C,opt1),opt2,E)) AND When(Ref(Mov(Mid(C,opt1),opt1,E),-1), >= ,(Ref(Mov((Mid(C,opt1)),opt2,E),-1))) AND When(Mov(Abs((Mo(opt3))),opt4,E), > ,Ref(Mov(Abs((Mo(opt3))),opt4,E),-1)) OPT1: 5 to 20 step 1 OPT2: 10 to 16 step 1 OPT3: 5 to 15 step 1 OPT4: 20 to 29 step 1 http://trader.online.pl/...st-Bianchi_Approach.html
Justin  
#4 Posted : Monday, March 2, 2009 1:13:49 PM(UTC)
Justin

Rank: Advanced Member

Groups: Registered, Registered Users, Unverified Users
Joined: 9/13/2004(UTC)
Posts: 673
Location: Salt Lake City, UT

That is a very old version of the MetaStock Formula Language. It should still work in the newer versions of the software though.

The formulas are designed for the System Tester, which is the only part of the software that allows for OPT values. If you wanted to convert the formula to use in the Explorer or Expert Advisor, you would have to replace any OPT reference with an actual number value.
opensource  
#5 Posted : Monday, March 2, 2009 6:25:18 PM(UTC)
opensource

Rank: Member

Groups: Registered, Registered Users, Subscribers
Joined: 1/27/2009(UTC)
Posts: 11

Justin wrote:
That is a very old version of the MetaStock Formula Language.  It should still work in the newer versions of the software though.

The formulas are designed for the System Tester, which is the only part of the software that allows for OPT values.  If you wanted to convert the formula to use in the Explorer or Expert Advisor, you would have to replace any OPT reference with an actual number value.
This does work in 10.1, I've tested it. Regarding replacing the any OPT reference with an actual number, does this have to be one constant number or could it be more than one? If one constant number, then say I wanted to try out with 10. What would the formula look like? Thanks.
johnl  
#6 Posted : Monday, March 2, 2009 10:13:44 PM(UTC)
johnl

Rank: Advanced Member

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


Replace the opt stuff with the input function (see user manual for examples).
Post back if you have a problem.
opensource  
#7 Posted : Wednesday, March 4, 2009 12:31:37 AM(UTC)
opensource

Rank: Member

Groups: Registered, Registered Users, Subscribers
Joined: 1/27/2009(UTC)
Posts: 11

My first crack at the formulas. There are some errors that I wasn't able to fix and hence couldn't test it on the Expert Advisor. Any help appreciated:
My attempt to convert the Bianchi Approach Systems tester to an Explorer or Expert Advisor Buy: When(Mov( Mid(C, 15, E), > ,Mov(Mid(C, 15, E)) AND When(Ref(Mov(Mid(C, 15,E),-1), <= ,(Ref(Mov((Mid(C, 15, E),-1) AND When(Mov(Abs((Mo(10))), E), > ,Ref(Mov(Abs((Mo(10))),E,-1)) Sell: When(Mov( Mid(C, 15), E) , < ,Mov(Mid(C, 15), E)) AND When(Ref(Mov(Mid(C, 15), E),-1), >= ,(Ref(Mov((Mid(C, 15)), E),-1))) AND When(Mov(Abs((Mo(10))), E), > ,Ref(Mov(Abs((Mo(10))),E),-1)) --- The original code is: Bianchi Approach Enter Long: When(Mov( Mid(C,opt1),opt1,E), > ,Mov(Mid(C,opt1),opt2,E)) AND When(Ref(Mov(Mid(C,opt1),opt1,E),-1), <= ,(Ref(Mov((Mid(C,opt1)),opt2,E),-1))) AND When(Mov(Abs((Mo(opt3))),opt4,E), > ,Ref(Mov(Abs((Mo(opt3))),opt4,E),-1)) Enter Short: When(Mov( Mid(C,opt1),opt1,E) , < ,Mov(Mid(C,opt1),opt2,E)) AND When(Ref(Mov(Mid(C,opt1),opt1,E),-1), >= ,(Ref(Mov((Mid(C,opt1)),opt2,E),-1))) AND When(Mov(Abs((Mo(opt3))),opt4,E), > ,Ref(Mov(Abs((Mo(opt3))),opt4,E),-1)) OPT1: 5 to 20 step 1 OPT2: 10 to 16 step 1 OPT3: 5 to 15 step 1 OPT4: 20 to 29 step 1 and can be found here: http://trader.online.pl/...st-Bianchi_Approach.html Thanks.
wabbit  
#8 Posted : Wednesday, March 4, 2009 1:28:09 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)
The When() function was dropped out of MS a long time ago, so have a read of the MS Users Manual and the free Equis Formula Primer to see how this situation is dealt with now. Do a search of the forum and look for discussions on Boolean operations and Boolean logic.

You might have noticed how many websites have simply propogated this ancient code without regard to updating for the latest chnages to MS; even newer website still show the old style codes.

Until you have finished the basic exercises in the Primer, I think you might have better luck with this code, demonstrating the use of variables and Boolean operations:

--------------------------------------
option1:=10;
option2:=15;
option3:=10;
option4:=10;

buy:=
Mov(Mid(C,option1),option1,E)>Mov(Mid(C,option1),option2,E)
AND
Ref(Mov(Mid(C,option1),option1,E),-1)<=Ref(Mov(Mid(C,option1),option2,E),-1)
AND
Mov(Abs(Mo(option3)),option4,E)>Ref(Mov(Abs(Mo(option3)),option4,E),-1);

sell:=
Mov(Mid(C,option1),option1,E)<Mov(Mid(C,option1),option2,E)
AND
Ref(Mov(Mid(C,option1),option1,E),-1)>=Ref(Mov((Mid(C,option1)),option2,E),-1)
AND
Mov(Abs(Mo(option3)),option4,E)>Ref(Mov(Abs(Mo(option3)),option4,E),-1);

buy-sell;
--------------------------------------

which can be further simplified by using even more variables, making the code run faster and it can be maintained and edited more easily:

--------------------------------------
option1:=10;
option2:=15;
option3:=10;
option4:=10;

midPoint:=Mid(C,option1);
midPointMA1:=Mov(midPoint,option1,E);
midPointMA2:=Mov(midPoint,option2,E);
momentumMA:=Mov(Abs(Mo(option3)),option4,E);

buy:=
midPointMA1>midPointMA2
AND
Ref(midPointMA1,-1)<=Ref(midPointMA2,-1)
AND
momentumMA>Ref(momentumMA,-1);

sell:=
midPointMA1<midPointMA2
AND
Ref(midPointMA1,-1)>=Ref(Mov((midPoint),option2,E),-1)
AND
momentumMA>Ref(momentumMA,-1);

buy-sell;
--------------------------------------

Change the option variables to whatever lengths you think they need to be. If you're going to run this code through the EST, change each option variable like this, for example:

option1 := opt1;
option2 := opt2;
option3 := opt3;
option4 := opt4;





Hope this helps.

wabbit [:D]

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.