translated LinearRegPredictSeries
Author: wicked1
Creation Date: 6/15/2009 9:45 PM
profile picture

wicked1

#1
Hi all. I thought I would venture into using version 5, and I'm attempting to convert a script (ADX Rising with linear regression) and I get the following output:

CODE:
Please log in to see this code.


I get the error 'The name 'LinearRegPredictSeries' does not exist in the current context.' Any help to fix this would be appreciated. Thanks.
profile picture

Eugene

#2
You may safely through this line away. LinearRegPredictSeries is a PerfScript-specific function that should not be used in ChartScripts for trading system rules. It's not available in WL5.
profile picture

wicked1

#3
Is there an alternative to use for this function? If I remove it completely from the script it no longer works correctly as it is a condition needed to make a buy signal.
profile picture

Eugene

#4
Let's put it the other way: the script was working absolutely incorrectly with this function included. This is mentioned in the QuickRef. It was clearly peeking into the future.

The function LinearRegPredict has no use in ChartScripts because a linear regression line it creates is built across the complete price series -- in other words, being fully aware of the entire historical data series.
profile picture

Eugene

#5
P.S. To get rid of the peeking function, you could reformulate the script to use the other linear regression functions. Check the QuickRef, Indicators section - or the WL5 Wiki: LinearReg, LinearRegSlope.
profile picture

wicked1

#6
Thanks for clarifying that for me Eugene. I'll look into the wiki when I get home.
profile picture

oaktree

#7
I have a different question about the WealthScriptTL class. I am using this thread because the code example listed above explains my question welll.

A. What is WealthScriptTL? I can't find any documentation regarding this class.
B. In the code provided above:

CODE:
Please log in to see this code.


It's obvious that the standard WealthScript class can't handle this (but WealthScriptTL can with some complicated overloading). Now if I just use the standard invocation as outlined in the reference guide for SellAtMarket:

CODE:
Please log in to see this code.


I get a compiling error:

QUOTE:
The best overloaded method match for 'WealthLab.WealthScript.SellAtMarket(int, WealthLab.Position)' has some invalid arguments
Argument '2': cannot convert from 'int' to 'WealthLab.Position'


I don't understand why this is an error. I have spent many hours on this issue. Any help to clarify the relation between WealthScriptTL and WealthScript will be appreciated. In other words, can one rely on the reference guide to modify/add a translated script?

profile picture

Cone

#8
I never use WSTL, but it's clear that it's treating LastPosition as an integer index to a Position object (as in v4) instead of the actual Position object, which is what v5 expects. Lesson: don't try to mix code with WSTL unless you know what you're doing!
profile picture

Eugene

#9
QUOTE:
A. What is WealthScriptTL? I can't find any documentation regarding this class.

This is a namespace coming from WealthScript Translator, that's why it's not documented in the QuickRef or WealthScript Guide. Since it's a translation layer, there's really nothing to document.
profile picture

reds

#10
Robert,

By "Lesson: don't try to mix code with WSTL unless you know what you're doing!" do you mean that if you use WSTL to convert code that you should not edit the code? In your opinion, is it better to start from scratch and code it in C# rather than translate it with WSTL?

Thanks,

Mike

profile picture

Cone

#11
I've never used WSTL, but in my mind its purpose is for those who want to translate hundreds of scripts to run in Rankings. If you have a handful of scripts that you designed and use, take the 30 or 60 minutes to learn the C# syntax required to translate most of your scripts by hand.
profile picture

reds

#12
30 to 60 minutes...you have not lost your sense of humor :-)
profile picture

Cone

#13
No, really. I think if you just take one Strategy, like the Glitch Index, and look at its 4x WealthScriipt code and compare it to the 5x C#, you'll see all the similarity you need to translate about 90% of all scripts on your own.
profile picture

reds

#14
That is a good approach. I keep putting it off but think once I take the plunge it will be well worth it. I remember when I first purchased WLD when it was initially launched years and years ago. I installed it and it was just an icon on my box for a year as I continued to use Tradestation. Once I made a minor commitment and with some help from Dion on a specific concept, I got it and haven't looked at TS since. I was waiting for the Optimizer to be added to WL 5.0 but it looks like that excuse has passed to..time to move on to C#.

Mike
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).