iHigh w/Arrays

 

Why is this not returning the iHigh values for the previous 10 bars? (It instead returns 10 10-digit numbers, seemingly unrelated to the price, including negative numbers):

 

    void start()

    {

    int bars = 10;

      if(bars >= Bars) bars = Bars - 1;

 

      double highs[];

      ArrayResize(highs, bars);

 

      for (int i = 0; i <= bars; i++)

          {

            highs[i] = iHigh(NULL, 0, i);

            Print(highs[i]);

     }

 } 
 

works just fine for me except for array out of range

for (int i = 0; i < bars; i++)

please use SRC

 

Play video
Please edit your post.
For large amounts of code, attach it.
 
qjol:

works just fine for me except for array out of range

please use SRC

 

Play video
Please edit your post.
For large amounts of code, attach it.




Fixed source, couldn't find that, thanks.

When I run it, it prints the following, for example for 0: "GBPJPY,H4: highvalues[0] = -1030792151".  It's a negative, and the high on GPBJPY for bar 0 (current) is 174.155 at that time.  What am I missing? 

 

i really don't know what to tell you here is my log (on the same symbol() and TF)

00:06:17 Script !test GBPJPY,H4: loaded successfully
00:06:17 !test GBPJPY,H4: initialized
00:06:17 !test GBPJPY,H4: 174.146
00:06:17 !test GBPJPY,H4: 174.166
00:06:17 !test GBPJPY,H4: 174.275
00:06:17 !test GBPJPY,H4: 174.206
00:06:17 !test GBPJPY,H4: 174.154
00:06:17 !test GBPJPY,H4: 173.636
00:06:17 !test GBPJPY,H4: 173.666
00:06:17 !test GBPJPY,H4: 173.379
00:06:17 !test GBPJPY,H4: 173.404
00:06:17 !test GBPJPY,H4: 173.321
00:06:17 !test GBPJPY,H4: uninit reason 0
00:06:17 Script !test GBPJPY,H4: removed

 
alyehoud:


Fixed source, couldn't find that, thanks.

When I run it, it prints the following, for example for 0: "GBPJPY,H4: highvalues[0] = -1030792151".  It's a negative, and the high on GPBJPY for bar 0 (current) is 174.155 at that time.  What am I missing? 

 

The code you posted can't produce this output, please post your actual code.
 
angevoyageur: The code you posted can't produce this output, please post your actual code.
And the actual output
Reason: