Trading my strategy / Polynomial curve fitting / Iterate through rule variables
Author: supermagnetman
Creation Date: 10/18/2017 6:08 PM

#### supermagnetman

#1
OK, As I continued to work to get the user interface better (re. the 1 point type used on the screen) I have found that wearing 3 pairs of reading glasses stacked on each other helps a lot but lots of the dialog boxes are still a matter of guess work as to what their label is, so the answer to my question my be more obvious if I the UI worked better. Just wanted to get that out there in case my question seemed ridiculous.

QUESTION 1 - I have successfully played with lots of strategies, created several rule based strategies and tweaked the variables to see the back test results. Now I want to go to the next step and connect this with my account and start using it in trading one test stock according to the rules strategy. I can't find anything that seems to do that. I think that is one aspect of the program that it does but I can't find where that is. I did use the data manager and connect to my account and it pulls in the list of the stocks. What I would really like would be for the program to be looking at the market data and provide some kind of signal for me to look at and make a trading decision.

QUESTION 2 - it looks like most of the strategies and rules are based on linear trend analysis. Are there any that would use like polynomial curve fitting? If not, if I dump the data out to Excel and develop, for example, a 7th order polynomial curve fitting equation to model a stock, is there a way to enter such an equation in the editor?

QUESTION 3 - Is there a way to programmatically set up a rules based strategy and iterate through its variables to determine which setting obtains the best performance? For example, It is interesting to see that for some stocks a 20 day moving average may lose money but a 12 day moving average beats the "buy and hold" option by 2 to 1. What I am doing is modeling a stock and then iterating manually through a range for the setting and recording the results to determine optimum. It would be nice if that could be done in a loop.

Thanks
I am getting to love this program despite my UI problems and hopefully one day that will get fixed.
George

#### Eugene

#2
Hi George,

Nice to know you're having progress. As a one-time exception I will answers your assorted questions in this thread but should you need some follow-up re: any of these answers, I kindly ask you to either create new topics or search the forum and reuse closely matching forum threads.

QUOTE:
Now I want to go to the next step and connect this with my account and start using it in trading one test stock according to the rules strategy.

Trading (live or paper) is done through Alerts which can be generated by your Strategy (or Strategy Monitor, but let's focus on the former for now). In terms of Wealth-Lab User Guide, this is covered in such chapters as Strategy Window > Strategy Window Views > Alerts View, and then Orders, Orders > Paper Trading etc.

QUOTE:
Is there a way to programmatically set up a rules based strategy and iterate through its variables to determine which setting obtains the best performance?

Optimizing rule-bases strategies is covered in the Wealth-Lab User Guide > Strategy Window > Strategy Builder > Parameter Sliders for the Strategy Builder.

Required reading to understand what Optimization is about: Strategy Window > Optimization > Full Optimization

QUOTE:
develop, for example, a 7th order polynomial curve fitting equation to model a stock, is there a way to enter such an equation in the editor?

No problem to code this in Wealth-Lab. C# is powerful language and polymomial curve fitting seems to have already been implemented in a 3rd party library that can be connected to Wealth-Lab and used in WealthScript code-based Strategy:

Use Math.NET's Fit.Polynomial method on functions of multiple parameters
Polynomial Fitting in C#
Curve Fitting: Linear Regression

I'm not the go to guy for this kind of math stuff but should you need advice on plugging in an external library like Math.Net just fire away e.g.

Using MathNet.Numerics

P.S. Please ask different questions in different threads, be they new or a closely matching existing one. From a forum management standpoint, packing unrelated questions into one topic like this is suboptimal for many reasons. Thank you.

#### supermagnetman

#3
Eugene

Thanks so much - that gives me enough to fill up my spare time for the next couple of weeks:)
George

#### superticker

#4
QUOTE:
a 7th order polynomial curve fitting equation to model a stock