Why does this return 0? - page 2

 
ChrisK99:

Complete code:

This is the output:

That isnt the complete code,  where is your start() function . . .

 

Try this code in the Strategy Tester,  I get this:

2013.06.07 18:24:07     2007.04.23 13:29  SAR-ST-Test EURJPY,M15: SAR_Current: 160.76762635  SAR_C: 160.76767635
Files:
 
RaptorUK:

That isnt the complete code, where is your start() function . . .

Try this code in the Strategy Tester, I get this:

Well, the complete code is about 3000 lines. I doubt it would help to post all of that. But I should have said it differently.

When I use your file, it's working. I don't get why it's not working within my EA. 

The part I posted is everything, SAR_C is used in. So why isn't it giving me the right result?

 
ChrisK99:

 

Well, the complete code is about 3000 lines. I doubt it would help to post all of that. But I should have said it differently.

When I use your file, it's working. I don't get why it's not working within my EA. 

The part I posted is everything, SAR_C is used in. So why isn't it giving me the right result?

Because your code is not allowing it to work as you think it should,  in other words your code is broken.  I can understand you not wanting to post your code, and I have no desire to trawl through 3000 lines of somone else's code,  but without seeing more detail it's hard to give much specific help.  

Add a Print() immediately after this line . . .

double SAR_C = iSAR(NULL,0,0.02,0.2,1)+0.00005;

  . . .  is this line always called or is it part of a custom function ? or is it conditional on something else ?   is your Print in the same function or a different function ?

 

Seems like I found the problem. Took me quite some time to figure out.

Thanks a lot for your help, angevoyageur and RaptorUK.

 
So post what it was so everyone can learn
 

It was a mistake in the code. I forgot some brackets that made it circumvent the definition of the variable.

Reason: