1 registered members (AndrewAMD),
831
guests, and 5
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Linear Regression in objective function
#469447
11/16/17 16:33
11/16/17 16:33
|
Joined: Aug 2017
Posts: 102 Spain
Brax
OP
Member
|
OP
Member
Joined: Aug 2017
Posts: 102
Spain
|
Hi, I am currently doing some research on optimization criteria and iīve got stuck trying to apply LinearRegSlope*R2 to optimize parameters. This code gives me an error regarding i need more lookback period:
var objective()
{
return LinearRegSlope(ResultsDaily,Bar-StartBar)*R2;
}
Iīve also tried with Day instead of Bar-StarBar, and even putting directly a number lower than lookback for the period gets a crush. ŋHow could i achieve this? The alternative is using (WinTotal-LossTotal)*R2, but this is not what i really want.
|
|
|
Re: Linear Regression in objective function
[Re: Brax]
#469558
11/21/17 13:13
11/21/17 13:13
|
Joined: Jul 2000
Posts: 27,986 Frankfurt
jcl
Chief Engineer
|
Chief Engineer
Joined: Jul 2000
Posts: 27,986
Frankfurt
|
Ok. I cannot tell why "it crushes" because I have not yet used an indicator on something else than a data series. But here is how to look into such a problem.
First, check if ResultsDaily is really nonzero in the objective function. I believe it is, but otherwise the problem is clear.
Next, call LinearRegSlope with something simple, like an array { 1, 2, 3 } of length 3, and check if it still "crushes". If so, then LinearRegSlope only works with a real data series for some reason, and you need the more common polyFit function. When you're at this point, post again and I'll help.
|
|
|
Re: Linear Regression in objective function
[Re: jcl]
#469563
11/21/17 19:32
11/21/17 19:32
|
Joined: Aug 2017
Posts: 102 Spain
Brax
OP
Member
|
OP
Member
Joined: Aug 2017
Posts: 102
Spain
|
Hi jcl.
ResultsDaily is nonzero and itīs reversed as you stated.
LinearRegSlope(ResultsDaily,Day) with LookBack = 0 doesn't seem to work properly. It always returns 1, maybe there is an issue with the reversed order of the series.
polyfit(0,ResultsDaily,Day,1,1) letting LookBack with its original value produces different results in training, but in test mode the system results aren't profitable when other criteria do.
I think i need to reverse the series or apply the slope over the differencies, need some help.
Thanks.
Last edited by brax; 11/21/17 19:38.
|
|
|
|