Gamestudio Links
Zorro Links
Newest Posts
Removing outliers from files
by AndrewAMD. 12/02/26 15:26
SGT_FW
by Aku_Aku. 11/30/26 08:19
Experiences with cTrader
by JeyKey II. 11/27/26 09:04
make a complaint
by EW_bytes. 11/26/26 23:00
FXCM => AVA Trade Plugin???
by Martin_HH. 11/25/26 21:59
No connection to MT4
by Martin_HH. 11/23/26 06:38
MinMax function on History t6 file
by LucasJoshua. 11/21/26 14:28
What are you working on?
by rayp. 11/20/26 18:10
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
3 registered members (AndrewAMD, BrainSailor, 1 invisible), 11,577 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
EvanTJ, rht, MaliceTheMaker, Haitao_Ren, JimSimons
19250 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Stuck in the Series again! #428386
08/26/13 18:19
08/26/13 18:19
Joined: Jun 2013
Posts: 41
Ohio, USA
P
Pork Offline OP
Newbie
Pork  Offline OP
Newbie
P

Joined: Jun 2013
Posts: 41
Ohio, USA
I'm thinking that the following should work:

function run()
{
vars P=series();
vars high=series(priceHigh());
int highndx;
int i;

for(i=0;i=LOOKBACK;i++)
{
if(high[i]<high[i+1])
{
highndx = i+1;
break;
}
}

P[0]=high[highndx];

}

But I am obviously wrong as I get a syntax error on the P[0]=high[highndx] . Pretty certain the problem has something to do with pointers. This hsa to be something stupid that I have missed because it it too stupid. Certainly you can move an array value to an array value.
Thanks
P
edit where error is.

Last edited by Pork; 08/26/13 18:20.
Re: Stuck in the Series again! [Re: Pork] #428387
08/26/13 18:41
08/26/13 18:41
Joined: Jul 2000
Posts: 28,150
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 28,150
Frankfurt
Your code has no syntax error. But it has an infinite loop. Can someone find it?

Re: Stuck in the Series again! [Re: jcl] #428390
08/26/13 18:51
08/26/13 18:51
Joined: Jun 2013
Posts: 41
Ohio, USA
P
Pork Offline OP
Newbie
Pork  Offline OP
Newbie
P

Joined: Jun 2013
Posts: 41
Ohio, USA
I been looking at this tooo long.
There is only one loop, so it has to be infinite, but I don't see it.
Break should exit the for when the condition matches.
so either the condition will never match or i will never be equal to loopback.
P

Re: Stuck in the Series again! [Re: Pork] #428393
08/26/13 19:22
08/26/13 19:22
Joined: May 2013
Posts: 245
S
swingtraderkk Offline
Member
swingtraderkk  Offline
Member
S

Joined: May 2013
Posts: 245
LookBack is not defined, so zorro tries to calculate it by adding one each time?

Re: Stuck in the Series again! [Re: swingtraderkk] #428399
08/26/13 20:15
08/26/13 20:15

A
acidburn
Unregistered
acidburn
Unregistered
A



for (initialization; comparison; continuation) { ... }

i=LOOKBACK is NOT comparison.

That's what's obvious, without running the script..

Re: Stuck in the Series again! [Re: ] #428400
08/26/13 20:34
08/26/13 20:34
Joined: Apr 2013
Posts: 57
3
3DCat Offline
Junior Member
3DCat  Offline
Junior Member
3

Joined: Apr 2013
Posts: 57
Try i<LookBack for your comparison (and also not i==LookBack)

edit: i guess your i=LookBack assignment always returns true thus your loop runs endlessly(am i right?)

Last edited by 3DCat; 08/26/13 20:53.
Re: Stuck in the Series again! [Re: 3DCat] #428414
08/27/13 08:11
08/27/13 08:11
Joined: Jul 2000
Posts: 28,150
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 28,150
Frankfurt
Yes, the comparison is wrong and LOOKBACK is a flag - what you meant was LookBack. C is case sensitve.

The "P[0]=high[highndx];" line however is correct.

Re: Stuck in the Series again! [Re: jcl] #428433
08/27/13 12:36
08/27/13 12:36
Joined: Jun 2013
Posts: 41
Ohio, USA
P
Pork Offline OP
Newbie
Pork  Offline OP
Newbie
P

Joined: Jun 2013
Posts: 41
Ohio, USA
Thanks All,
Appreciate the help.
The LOOKBACK being a flag was not a problem I was thinking about.
Good to know there is an option.
Changing code feverisly laugh
I seem to struggle with some of the more simple concepts of C.
P


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