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

Notification

Icon
Error

Options
Go to last post Go to first unread
Gerrit  
#1 Posted : Sunday, October 9, 2005 2:35:01 PM(UTC)
Gerrit

Rank: Member

Groups ready for retrieval: Registered, Registered Users, Subscribers
Joined: 4/18/2005(UTC)
Posts: 25

Can you please make it possible to use optimising variables in custom indicators in system tests the same way you can optimise your own indicators? I can say MOV(C, OPT1, S), why can I not do the same on my own indicators!! Surely if we have 3 input statements in a custom indicator it should be simple enough to assign the values from optimisations to a custom indicator. Something like Fml( "My super Ind", OPT1, OPT2, OPT3) would be a huge help. Not sure how many people watch this forum but if you have been around and you know how much this would help please vote in the poll!!
henry1224  
#2 Posted : Sunday, October 9, 2005 7:28:11 PM(UTC)
henry1224

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 10/29/2004(UTC)
Views messages in topic : 1,394
Location: Glastonbury, CT

Was thanked: 2 time(s) in 2 post(s)
Gerrit, This feature is already included in the system tester! You mention 3 input functions, Input functions are not allowed in systems, explorations, or experts per se. If you use a Fml() function or FmlVar() function from a custom indicator that uses Input functions then the default values will be used. What you have to do is replace the input function with Opt1, Opt2 IE: A:=Input("length1",3,20,5); A1:=Input("length2",9,60,15); A2:=Input("SIG length3",3,20,5); SHOULD READ in the system tester A:=Opt1; A1:=Opt2; A3:=Opt3; So your poll is moot
Patrick  
#3 Posted : Sunday, October 9, 2005 7:33:12 PM(UTC)
Patrick

Rank: Advanced Member

Groups ready for retrieval: Registered, Registered Users, Subscribers
Joined: 9/8/2004(UTC)
Posts: 2,266

Was thanked: 1 time(s) in 1 post(s)
Optimise a custom indicator ok, to what end ... How do you know which value to use so that your indicator is optimum ... How should the code decide which opt value to use ... I'm genuinly asking what the purpose would be, give me a specific example please :D Patrick :mrgreen:
Gerrit  
#4 Posted : Monday, October 10, 2005 7:26:25 PM(UTC)
Gerrit

Rank: Member

Groups ready for retrieval: Registered, Registered Users, Subscribers
Joined: 4/18/2005(UTC)
Posts: 25

Henry Thanks a lot for the suggestion but I could not make it work, it sounds just like what I need though. I’m pretty sure this is something that needs to be changed in metastock to give it a very practical edge! So let's be clear. INDICATOR BUILDER I go into the indicator builder and build my own indicator. It is a huge formula that will just confuse the issue here. Note combining it with the buy condition logic simply will not fit into the system test if I paste into it. Let's just say in this indicator I refer to things like moving averages etc. for example. On every stock I want to view I need different settings, so I add a variable and set it from an input statement. Great for viewing the ind. SYSTEM TESTER Now I do not know what all the good settings in my indicator are that would work best with my system so I go to the indicator builder and refer to my indicator by fml(). According to the metastock manual when fml is used the default value of inputs are used. I just tried to go into the indicator builder now with your suggestion, but I get the error saying "Optimization variables are not allowed in this type of formula". Patrick, hope you understand now and hopefully either you, Henry or someone out there has a way to do this. One last point is that if I had to use OPT variables in the indicator instead of an input I would have to change the code each time I switch between using the ind on a chart and using it in a system test. But even that would be an improvement. So the suggestion is: Have the input statements filled from system tests or even experts and explorers with what ever is being passed into fml(). So fml("my ind", OPT1 , OPT2, OPT3) gets placed as if they were input into the indicator on a chart from top to bottom. Thanks Gerrit
Patrick  
#5 Posted : Monday, October 10, 2005 7:33:12 PM(UTC)
Patrick

Rank: Advanced Member

Groups ready for retrieval: Registered, Registered Users, Subscribers
Joined: 9/8/2004(UTC)
Posts: 2,266

Was thanked: 1 time(s) in 1 post(s)
It makes perfect sense ... I will think about it :D
mstt  
#6 Posted : Monday, October 10, 2005 8:31:08 PM(UTC)
mstt

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 7/25/2005(UTC)
Posts: 1,042

Was thanked: 57 time(s) in 54 post(s)
Gerrit If you write to me privately I'll explain to you how you can optimise code outside the System Tester. Of course it's not as simple as writing "OPT1", but it's easy enough when you understand the principles involved. The key to it is knowing that the OPT constants can be made available to indicators. My method has been explained in a certain monthly newsletter that I'm not allowed to name. I assume I'm still allowed to give my email address so here it is - rlarsen@man.quik.co.nz Roy
Marilyn  
#7 Posted : Monday, October 10, 2005 9:17:29 PM(UTC)
Marilyn

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 9/10/2004(UTC)
Posts: 863
Location: Salt Lake City, UT

Roy... you can name your newsletter... I think there are spam rules around here somewhere. I read them at one stage and it essentially says - if you are a contributing member of our society you can place a link where it is relevant but don't go around posting links everywhere trying blanket sell your stuff on the forum... especially if you don't contribute on a regular basis... That doesn't sound like you... :) I will let Patrick give the final say but there is my two cents. :) M
Gerrit  
#8 Posted : Tuesday, October 18, 2005 7:14:09 AM(UTC)
Gerrit

Rank: Member

Groups ready for retrieval: Registered, Registered Users, Subscribers
Joined: 4/18/2005(UTC)
Posts: 25

Hi Patrick, I hope you have thought about it and decided to do it :D It will really make sense not to have different copies of the same code all over the show. I am sure it can avoid some distasters too with code being central. And note that my strategy tests would have been impossible to optimise productively without Roy's trick. Roy. Thanks for the info, I have used the GV.dll now in both my system test and in my expert adviser. I still need two copies of my indicator though. One for expert + system test and one for graphs, but I'm not complaining, at least now I can do what would have been impossible without your help. =D> Thanks Gerrit
Patrick  
#9 Posted : Tuesday, October 18, 2005 2:32:47 PM(UTC)
Patrick

Rank: Advanced Member

Groups ready for retrieval: Registered, Registered Users, Subscribers
Joined: 9/8/2004(UTC)
Posts: 2,266

Was thanked: 1 time(s) in 1 post(s)
Is the GV.dll simply a "global" variable container? ... It's free right? So I guess it does not really need to be done again, unless there is a need to combine functions into one dll ... I will wait for your comments ... Patrick :mrgreen:
Gerrit  
#10 Posted : Tuesday, October 18, 2005 7:44:54 PM(UTC)
Gerrit

Rank: Member

Groups ready for retrieval: Registered, Registered Users, Subscribers
Joined: 4/18/2005(UTC)
Posts: 25

Hi Patrick, two points: 1) If we could simply code custom formula's with input statements, and have the option of calling them from tests etc. with parameters that would fill in the input statements, we have 1 indicator working in ANY place in metastock that can call a custom indicator. At the moment I still have to have 2 copies of the same indicator which adds much unwanted maintenance overhead. One for graphs and one for tests and experts. 2) The global variable dll is handy, but after all is said, it is plainly a means to get around a limitation. I still end up adding code and still end up having to sacrifice some readability for the sake of being able to fit into small space limits. Coding this should be fairly easy for someone of your talent right :) Just stack the parms as you read them from the source text and let the indicator input them from the stack? Just an idea, guessing from outside. Thanks Gerrit
mstt  
#11 Posted : Tuesday, October 18, 2005 8:40:30 PM(UTC)
mstt

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 7/25/2005(UTC)
Posts: 1,042

Was thanked: 57 time(s) in 54 post(s)
Patrick A "variable container" is a good way to describe the GV.dll. Yes it's free, thanks to the author, Mark Pyle. However the MFL support code necessary to use it for optimising outside the System Tester, rank portfolios for the purposes of back-testing, or generate portfolio equity curves etc., is not so readily available. Nevertheless, I've posted numerous items on a variety of ways that GV can be used, so there's no shortage of information available. However the concept of reading and writing to an external variable holder seems to be a major obstacle for many MS users. One or two GV shortcomings also make it more difficult to use in portfolio-based tools. The optimising tool that Gerrit has mastered is a relaitively simple GV application. This is not a reflexion on Gerrit - in fact I was pleasantly surprised that he didn't need or ask for additional help once he had basic instructions. My "solution" to the problem Gerrit now faces was a reaction to several MetaStock limitations. There are two issues that need to be recognised by the MetaStock development team, if there is such a team. 1. The Enhanced System Tester code windows have approximately 40% of the capacity of every previous code window MS has ever used (emphasing a point rather that stating a fact). Reducing the code space to 40% of what was previously too small was a serious error of judgements on someones part. MS users don't care what good reasons were behind the changes in window size, be we would like the problem acknowledged and eventually addressed. 2. Indicator Input() functions only make the default values available to other tools. There is no practical way of substituting that default value with an OPT paramater inside the System Tester, and insuficient space for the most part to modify and move the custom indicator into the System Tester. I see point 1 as the bigger roadblock. Roy roy@metastocktips.co.nz
Patrick  
#12 Posted : Tuesday, October 18, 2005 8:46:33 PM(UTC)
Patrick

Rank: Advanced Member

Groups ready for retrieval: Registered, Registered Users, Subscribers
Joined: 9/8/2004(UTC)
Posts: 2,266

Was thanked: 1 time(s) in 1 post(s)
Quote:
One or two GV shortcomings
What are those ... If I end up rewriting something similar to the gv.dll mind as well try to improve it ... Thanks for the feedback ;) Patrick :mrgreen:
mstt  
#13 Posted : Tuesday, October 18, 2005 9:24:14 PM(UTC)
mstt

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 7/25/2005(UTC)
Posts: 1,042

Was thanked: 57 time(s) in 54 post(s)
Patrick There are two main problems. 1. I think GV uses single digit precision, just as MS does. When a cell is used as an accumulator it loses accuracy above 6 significant digits. 2. Cells appear not be date alligned, or "date-tagged" perhaps. This is not a problem when processing securities serially (results only relate to one issue) or accumulating just one simple value in an exploration. However it is a big problem when accumulating (parallel processing) across a portfolio when any issue in the portfolio is missing a bar of data. Each missing bar results in the GV data array crabbing to the left. Those results are meaningless and useless. Even when a portfolio has identical data bars for all securities, the resullting data arrays have to be date-aligned with a bit of trickery before the results can be used elsewhere. Roy roy.metastocktips.co.nz
mstt  
#14 Posted : Tuesday, October 18, 2005 9:26:17 PM(UTC)
mstt

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 7/25/2005(UTC)
Posts: 1,042

Was thanked: 57 time(s) in 54 post(s)
Gerrit You might also be interested to know that I've used the GV dll to get around the "only the default value is availaible" problem at times. However this was done to make one specific value available to an exploration (I think), not to provide a range of values to the System Tester. How it works is that an idicator on a chart saves the user value (rather than the default) as a GV, then the exploration calls the GV value and applies it to a copy of the custom formula. This also means that you end up with two copies if the formula, one as an indicator and one as a an element of the exploration or systems test. I haven't yet got my head around how this this approach might be used to further simplify what you're trying to do. There's no getting away from the need to add code simply to store user parameters as GVs, but that doesn't obsolete that formula as far as more normal activities are concerned. You would leave all normal variables in place, and add the ability to change one or more user parameters (Parameter window) to be picked up by other tools such as the ST or Explorer. Space may again be a problem. That's the main reason why I renamed Marks GlobalVar dll as GV. Roy roy@metastocktips.co.nz
Gerrit  
#15 Posted : Sunday, October 23, 2005 7:48:32 PM(UTC)
Gerrit

Rank: Member

Groups ready for retrieval: Registered, Registered Users, Subscribers
Joined: 4/18/2005(UTC)
Posts: 25

Hi Patrick/Roy Just on the topic of space versus passing parameters to a custom indicator, my opinion is that having the ability to pass parameters is even more useful than simply more space. My reason for saying this is that code being central will both reduce the number of times we code the same thing, and also achieve the second goal of reducing space needed to code system tests and explorers. Roy Thanks for the note about the indicator on a chart with input() setting the GV. That might help me reduce my expert adviser code to have one generic expert for all my charts. I'll have to test it out first though, as there may be many opportunities for system tests, other charts etc. to modify the GV giving me 'corrupted' GVs if I'm not careful. Very nice idea though, I'm going to try it out and if it works use it until we can call cutom inds with parms :) Thanks Gerrit
mstt  
#16 Posted : Monday, October 24, 2005 10:14:19 PM(UTC)
mstt

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 7/25/2005(UTC)
Posts: 1,042

Was thanked: 57 time(s) in 54 post(s)
Hi Gerrit I'm glad you're alert to the possibility of corrupted global variables. That's a problem that can and will occur if you don't take preventative measures. One has to remember that a GV can only give out what's been put in. Reading (GetVar) a GV variable before writing it (SetVar) won't give an error message, but it will return garbage. Also, accessing a GV (assuming it's) for one security when it was last written from and for another security will also give bad results. The best way around this sutuation that I've found, at least as far as explorations go, and I assume the same will work for experts, is to call the formula that sets up the required GVs before attemping to use them. As an example, all GV based Trade Equity explorations call the supporting TE formula in column A before attempting to use the TE GV data arrays. The following column A for Trade Equity GV LE is not a particularly good example because most of that code relates to creating a portfolio equity curve, and those variables are reset by dropping a custom "reset" indicator onto a chart. The portfolio action, marked by {*}, has to start at zero and accumulate from one security to the next to arrive at a final value for every bar across the entire portfolio. However, just summing the equity from each trade within one security requires the TE formula must be called for that security before MS can accumulate the equity spike at the end of each trade. In other words, the GV variables used by TE are always refreshed (updated) on the current security before being read. This also applies to the portfolio accumulation, but of course it is inappropriate to meddle with the accumulators between one security and the next. That's why the reset is done with an indicator BEFORE running an exploration to generate a portfolio (database) result. A portfolio-based GV reset could also be done with a single security exploration, but I've found that indicators work best, and anyway, an indicator has to be used to display a portfolio result (not the same indicator though). {Column A: $ Profit} {Net profit} Eq:=Fml("Trade Equity GV LE"); {*}Tr:=ExtFml("GV.GetVar","Tr"); {*}Cp:=ExtFml("GV.GetVar","Cp"); {*}Equity:=ExtFml("GV.GetVar","Equity"); {*}Trades:=ExtFml("GV.GetVar","Trades"); {*}Equity:=ExtFml("GV.SetVar","Equity",Eq+Equity-Cp); {*}Trades:=ExtFml("GV.SetVar","Trades",Trades+Tr); N :=ExtFml("GV.GetVar","N"); Cum(N); {accumulate the sum of all trades for current security} Roy
Gerrit  
#17 Posted : Tuesday, November 8, 2005 8:31:30 AM(UTC)
Gerrit

Rank: Member

Groups ready for retrieval: Registered, Registered Users, Subscribers
Joined: 4/18/2005(UTC)
Posts: 25

Hi Roy Thanks for the tip of having a function just for setting the variables. It certainly helps. In experts we need to call that function in every single write statement we code. While optimising some weard results are now making realise your point about single decimal precision being a problem in GV. I tried so far to get around that problem by multiplying by 100 the variables before I set them in the system tester, and then dividing them by 100 in the custom indicators after I get them. So far the results still seem dodgy but I will have another scan through it in case I coded something poorly. By the way I have ordered the developers kit last week, so we'll see what I can come up with once I have that. I am sure there is yet another learning curve for me to go through in there! Thanks Gerrit
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.