Download MetaTrader 5
To add comments, please log in or register
Publish your article and get a reward!
slavename
64
slavename 2014.07.01 21:55 

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 2014.07.01 22:15  

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 2014.07.01 23:19  
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 2014.07.02 00:08  

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
28645
Alain Verleyen 2014.07.03 14:59  
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
13637
whroeder1 2014.07.03 16:28  
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