New internal inputs check for XAverage, etc.

Questions about MultiCharts and user contributed studies.
Fu510n
Posts: 22
Joined: 05 May 2011
Has thanked: 17 times
Been thanked: 7 times

New internal inputs check for XAverage, etc.

Postby Fu510n » 13 Dec 2016

Hmm...

This new "feature" is causing me grief:

- Built-in functions (XAverage, XAverageOrig, WAverage) now have internal inputs check and will show an error message if negative input value is specified.

Strategy code that's worked for years is now bailing reporting "XAverage. Check Len input should be >= 1.". Given that XAverage is a built-in/read-only function, it's a bit difficult to know what values are being passed that are causing the issue since I can't inject MessageLog() output for diagnosis. XAverage() itself is both called directly and by a LOT of other built-in & custom functions - anyone else having similar issues?

Thanks,
-Guy

Fu510n
Posts: 22
Joined: 05 May 2011
Has thanked: 17 times
Been thanked: 7 times

Re: New internal inputs check for XAverage, etc.

Postby Fu510n » 13 Dec 2016

After spending WAY too much time trying to further isolate the issue, I was able to mitigate the "error" by commenting out code THAT WAS NEVER EXECUTED (hard-coding "False", etc.) so for now I'm reverting back to MultiCharts64.10.0.13557.400_Release_x64 (from 13626) as the most recent release appears to have "issues".

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: New internal inputs check for XAverage, etc.

Postby TJ » 13 Dec 2016

Hmm...

This new "feature" is causing me grief:

- Built-in functions (XAverage, XAverageOrig, WAverage) now have internal inputs check and will show an error message if negative input value is specified.

Strategy code that's worked for years is now bailing reporting "XAverage. Check Len input should be >= 1.". Given that XAverage is a built-in/read-only function, it's a bit difficult to know what values are being passed that are causing the issue since I can't inject MessageLog() output for diagnosis. XAverage() itself is both called directly and by a LOT of other built-in & custom functions - anyone else having similar issues?

Thanks,
-Guy

It should not be difficult to trace your Len input bug.

Do you have it set as a changeable variable?
Most people have a fixed value. You know the input, and it never changes.

User avatar
bensat
Posts: 331
Joined: 04 Oct 2014
Has thanked: 46 times
Been thanked: 104 times

Re: New internal inputs check for XAverage, etc.

Postby bensat » 13 Dec 2016

What about writing/using your own xAverage funtion ? It's not my code and I do not know the source, but it gives similar results.

Code: Select all

Inputs: Price(NumericSeries), Length(NumericSimple);

Variables: w(0), xlen(0), pv(0);

if CurrentBar <= 1 then pv = Price else pv = _xAverage[1];

if xlen <> Length or CurrentBar <= 1 then begin
w = 2 / (Length + 1);
xlen = Length;
end;

_xAverage = w * Price + (1 - w) * pv;
Kind Regards.

Ben

Fu510n
Posts: 22
Joined: 05 May 2011
Has thanked: 17 times
Been thanked: 7 times

Re: New internal inputs check for XAverage, etc.

Postby Fu510n » 14 Dec 2016

What about writing/using your own xAverage funtion ? It's not my code and I do not know the source, but it gives similar results.

Code: Select all

Inputs: Price(NumericSeries), Length(NumericSimple);

Variables: w(0), xlen(0), pv(0);

if CurrentBar <= 1 then pv = Price else pv = _xAverage[1];

if xlen <> Length or CurrentBar <= 1 then begin
w = 2 / (Length + 1);
xlen = Length;
end;

_xAverage = w * Price + (1 - w) * pv;
Kind Regards.

Ben
MC does include source to XAverage() and other functions improved by this parameter range check, alas, the "check" itself isn't actually in the EasyLanguage code but rather something that either the compiler is doing behind the scenes or some other voodoo that I haven't bothered to dig up (I have captured the gcc-generated C/C++ source during the EL translation in the past just to see "how things worked" FWIW).

That being said, while it would be easy enough to replace XAverage() (as called in my own code), this ends up becoming a rat hole as there are other functions that also call XAverage() that are read-only and would also need to be replaced as well. Given the prior MC version worked just fine for my needs, it's simply easier at this point to revert to that version until the MC team figures out what's causing this odd behavior.

Thanks for your input :).

Fu510n
Posts: 22
Joined: 05 May 2011
Has thanked: 17 times
Been thanked: 7 times

Re: New internal inputs check for XAverage, etc.

Postby Fu510n » 14 Dec 2016

Hmm...

This new "feature" is causing me grief:

- Built-in functions (XAverage, XAverageOrig, WAverage) now have internal inputs check and will show an error message if negative input value is specified.

Strategy code that's worked for years is now bailing reporting "XAverage. Check Len input should be >= 1.". Given that XAverage is a built-in/read-only function, it's a bit difficult to know what values are being passed that are causing the issue since I can't inject MessageLog() output for diagnosis. XAverage() itself is both called directly and by a LOT of other built-in & custom functions - anyone else having similar issues?

Thanks,
-Guy
It should not be difficult to trace your Len input bug.

Do you have it set as a changeable variable?
Most people have a fixed value. You know the input, and it never changes.
I typically have variables that would be candidates for optimization as "changeable variables" (~250 of them; though these support 40-50 strategies all encapsulated in the same "trading engine", not all of which are necessarily enabled/used at the same time).

I ended up embedding a lot of MessageLog() messages to see where things were running afoul but MC was still halting even though XAverage() wasn't being called which made no sense (i.e. the error itself is being triggered falsely for some reason). I'm generally up for a programming/debugging challenge (I've been doing this for 30+ years), I just don't have the time at the moment particularly for something that was literally JUST introduced and as such, most likely has a bug or two.

Thanks for your suggestion(s) :)

SP
Posts: 465
Joined: 06 Feb 2006
Has thanked: 36 times
Been thanked: 286 times

Re: New internal inputs check for XAverage, etc.

Postby SP » 14 Dec 2016

Had some error messages as well. Changing the Len (Numericsimple) to Len (Numericseries) solved it.


Return to “MultiCharts”