Gamestudio Links
Zorro Links
Newest Posts
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
Release 2.68 replacement of the .par format
by Martin_HH. 09/23/25 20:48
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
1 registered members (dBc), 17,435 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Inconsistent series populated by several for loops - how to fix? #463087
11/14/16 19:36
11/14/16 19:36
Joined: Nov 2016
Posts: 7
CA - California
M
Mucko Offline OP
Newbie
Mucko  Offline OP
Newbie
M

Joined: Nov 2016
Posts: 7
CA - California
I have several for loops that look at the last 10 bars for a high/low pattern. One loop records a high values if high pattern found, another loop records the low value if pattern found.

This data is then put into a WMA function for the last x values.

However, I am getting Error 041:Inconsistent Series! error. I believe the issue is that the arrays are not populated with the same length nor at the same time.

I am not sure how to fix this error - any help would be appreciated.

Code snippet (for High):

if (Close[1] > Open[1] and Close[0] < Open[0]) {
double u11 = High[1];

for (qq=1;qq<=len; qq++)
if (qq <= ttfinal)
qqtot+= u11;
else
qqtot += (High[qq - (ttfinal -1)]);


vars u1 = series((qqtot/len));
qqtot = 0;
hcount +=1;
}
vars upp = series(WMA(u1,len));

Re: Inconsistent series populated by several for loops - how to fix? [Re: Mucko] #463099
11/15/16 05:07
11/15/16 05:07
Joined: Nov 2016
Posts: 7
CA - California
M
Mucko Offline OP
Newbie
Mucko  Offline OP
Newbie
M

Joined: Nov 2016
Posts: 7
CA - California
Solved - I think

I think I have solved it with a bit of added code. Still need to test if it gives the same result as the original code (ported from MC/TS), but it does not give inconsistent errors any longer and can plot values which appear correct from initial appearances.

Here is what I had to add, removing the series function from inside the for loop but still inside the if conditional. Rather than loop I simply manually populate and increment.

This is defined outside the conditional:
q = series();

this is inside the conditional:
q[hcount] = (qqtot/len);
hcount +=1;
qqtot = 0;


Moderated by  Petra 

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1