Download MetaTrader 5

iHigh w/Arrays

To add comments, please log in or register
slavename
64
slavename  

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]);

     }

 } 
qjol
3243
qjol  

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.
slavename
64
slavename  
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? 

qjol
3243
qjol  

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

Alain Verleyen
Moderator
31184
Alain Verleyen  
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.
whroeder1
14779
whroeder1  
angevoyageur: The code you posted can't produce this output, please post your actual code.
And the actual output
To add comments, please log in or register