Stat functions crashing in evaluate()

Posted By: Zheka

Stat functions crashing in evaluate() - 06/03/22 18:13

var r2 = LinearRegSlope(AssetC+NumBars-50,20); crashes (similar to Hurst, FractalDimension, MaxVal, etc) while Spearman() and R2() don't.
Posted By: Petra

Re: Stat functions crashing in evaluate() - 06/06/22 09:04

Data and price series are a) expected in reverse order and b) only valid in the run function or in functions called by run().

https://zorro-project.com/manual/en/series.htm

I'm pretty sure that includes AssetC.
Posted By: Zheka

Re: Stat functions crashing in evaluate() - 06/06/22 09:56

LinearRegSlope(), etc will crash in objective() even if fed with a standard var array (of pip-based equity curve). How can one use Zorro's stat functions in objective()/ evaluate()?
Posted By: Petra

Re: Stat functions crashing in evaluate() - 06/06/22 10:49

Evaluate and objective are for evaluating results. Indicators and price series are released at session end.

TA-Lib indicators work anyway only with series according to the manual, I guess you cannot use them with arbitrary data. You can see in the manual or in the functions.h list which functions are from the TA-Lib.

For regression use the polyfit function. LinearRegSlope is a TA-Lib indicator and not for general statistics.

If you need indicator returns in evaluate for some reason then get them while the session is still running, for instance in the EXITRUN.
Posted By: Zheka

Re: Stat functions crashing in evaluate() - 06/06/22 18:05

Indeed, the manual states that the input for such functions should be a 'series'.

However, I always used them in run() with standard arrays without a problem (a var* is a var*, right?) It only crashes in optimize()...

TA_Lib by itself operates with standard arrays as input -so why limit this to series() in Zorro?

I don't understand the distinction you make on 'indicators' vs ... : TA_Lib provides 'functions', incl. some pretty common ones like MaxVal() or LinearRegSlope().

I am not calculating 'indicators' in optimize(). I would like to use measures based off equity curve (e.g. its slope) as a constituent of the train objective. Shall I write my own functions for that??
Posted By: jcl

Re: Stat functions crashing in evaluate() - 06/08/22 05:54

I am sure that you'll manage that, like any other user.

BTW, the crash was in fact a bug. It was supposed to print an error instead. This will be fixed.

It would help your cause when you explained why and for what strategy you have all those strange requests and issues. We did so far > 1200 systems and tools with Zorro, often very exotic, but never had to use a ta-lib indicator in result evaluation. But it can be still implemented if it serves any useful purpose.
Posted By: Zheka

Re: Stat functions crashing in evaluate() - 06/08/22 10:59

I would like to use measures based off equity curve as a constituent of the train objective.

For that, I would like to use a min/max of a time series, linear reg slope, correlation, etc...elementary statistical functions..

Those happen to already be available in Zorro from TA_Lib.

TA_Lib inherently provides a list of functions, consuming standard arrays/pointers.

For some reason, you call them 'indicators' and only restricted their use to Zorro's 'series' objects (...but they actually work with std arrays in run(), but not in optimize())...

I really don't understand what's so 'indicatory' (and therefore 'strange' in your opinion) about linear regression or min/max of a series of values...
Posted By: jcl

Re: Stat functions crashing in evaluate() - 06/08/22 11:37

Ok, but why are you not doing this in the EXITRUN?

Ta-lib functions need a special handling due to the reversed order of time series. That's why they cannot be arbitrarily called.
Posted By: Zheka

Re: Stat functions crashing in evaluate() - 06/08/22 12:07

I didn't know trade and strategy statistics are available already in the EXITRUN. Is there anything NOT available in EXITRUN compared to objective()?

If Zorro reverses the order of series() under the hood to get meaningful/expected results from TA_Lib functions, then a user can do the same manually when feeding an std array...but the functions can still work..
Posted By: jcl

Re: Stat functions crashing in evaluate() - 06/08/22 14:44

Depends on what you mean with 'statistics'. There are no statistics in the exitrun. But all is there that you could use with ta-lib functions, like prices, series, equity curve, etc.
Posted By: Zheka

Re: Stat functions crashing in evaluate() - 06/08/22 18:45

By trade and strategy statistics I meant https://zorro-project.com/manual/en/winloss.htm and https://zorro-project.com/manual/en/statistics.htm
Posted By: jcl

Re: Stat functions crashing in evaluate() - 06/09/22 09:16

Winloss is available at any bar and derived values like R2, Ulcer, Mean, etc only in objective().

As a rule of thumb, any value that is calculated only once based on the complete data, is, obviously, only available after session end.
© 2024 lite-C Forums