[ARCHIVE]Any rookie question, so as not to clutter up the forum. Professionals, don't pass it by. Can't go anywhere without you - 5. - page 235

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
To understand what's going on, you need to output the calculations to the printer:
and analyze the results.I REALIZED I MUST HAVE MISUNDERSTOOD SOMETHING.
How I imagined the execution of the condition in the if header
-program gets value of Bid variable (0.86084)
-drops the value of variable Bid (0.86084) to variable massiv[S] (0.85375)
-maps the obtained difference 0.00709 to the constant 0
-if the difference is > 0, control in the if statement body is not given and the order is not opened
-If the difference <= 0, control is delivered to the if statement body and the order is opened
As I imagined the execution of function ArrayBsearch( massiv, value,WHOLE_ARRAY, 0, MODE_ASCEND)
TIP: Returns the index of the first found element in the first array dimension.
If there is no element with the specified value in the array, the function will return the index of the closest by value element, between which the sought value is located.
-the function gets the value equal to the price of the last tick (Bid-0.86084)
-the function goes through the array values from the lesser to the greater - it doesn't find the full match between any value of the array and the value value
- as there is no value 0.86084 in the array, the function returns the closest smallervalue of the array. i.e. 0 .820864(first),0.81074,0.85375,0.80084,0.81084,0.86088(last) i.e. 0.85375 is the closest value to 0.86084 the smaller value. Between 0.85375 and 0.86088 is the value you are looking for=0.86084
=====================================================================================================
Theparameters in your function print besides value of element massiv[S] are: massiv[S-1] and massiv[S+1]. From value of massiv[S]( 0.85375) you first subtract 1, and then add 1.
I haven't read about if in header (or in ArrayBsearch()) from arrayiv[S] value firstly 1 is subtracted and then 1 is added.
I would appreciate it if you could explain this point to me or give me a link.
Thank you.
Thefunction print has anotherparameters - massiv[S-1] and massiv[S+1]. You want to subtract 1 from massiv[S]( 0.85375) value and add 1 after it.
I haven't read about if header (or ArrayBsearch() ) first subtract 1 from massiv[S] value and then add 1 to it in any MQL textbook.
I would appreciate it if you could explain this point to me or give me a link.
Thank you.
Print in this link.
http://clip2net.com/s/4MRjJe
I noticed that
- the value of massiv[0](probably [S]) is the first value of the array to begin with
- value of massiv[1](probably [S+1] ) is the second value of the array, i.e., it follows the value from which the array begins
-These values are repeated every time PRINT is encountered.
=============================================
- in the year 2000, the price value was 4 more digits after the dot.
- in the tester on the chart - 5 digits
-in the tester in the result - 5 signs
-in the tester in the log in the printer - 4 characters
And I have 5 digits in the array.
QUESTION - How many digits does the software read?
Print in this link.
https://www.mql5.com/go?link=http://clip2net.com/s/4MRjJe
You don't see anything there???
I see that ArrayBsearch() returns 0 (as an element index) EVERYWHERE. In the 0th cell of your array is the number 1.0408. Let's go back to the code:
Now substitute the obtained variable values in this condition (on the carite Bid is in the range 0.8-0.9, let's take the maximum of this range - 0.9): if (0.9000 - 1.0408 <= 0) OrderSend(). The condition is fulfilled RIGHT!!! Look for errors in completing your array. You presumably did not pay attention to this clause in the ArrayBsearch() function:
Note: Binary search only handles sorted arrays. The ArraySort() function is used to sort a numeric array.
P.S. Print should preferably be provided not as picture, but by simultaneous selection of several lines (using SHIFT - if you don't know how to do it) of this very print (10-20 lines is enough) in terminal window, then copy and paste selected lines in your post as code using SRC button.
P.P.S. I just noticed the obvious syntax error - this line should be placed outside (before) the start() function:
#include <MASSIV.mqh>
I noticed that
-in the tester in the log in the printer- 4 characters
Read documentation https://docs.mql4.com/ru/common/print
Arrays cannot be passed to Print(). Arrays must be printed element by element.
Data of the double type is printed with 4 decimal digits after the point. To get more accuracy, the DoubleToStr() function should be used.
You didn't see anything there???
I see that ArrayBsearch() returns 0 (as an element index) EVERYWHERE. In the 0th cell of your array is the number 1.0408. Back to the code:
Now we substitute the obtained variable values into this condition (Bid on the carotine is in the range of 0.8-0.9, let's take the maximum of this range - 0.9): if (0.9000 - 1.0408 <= 0) OrderSend(). The condition is fulfilled RIGHT!!! Look for errors in completing your array. You presumably did not pay attention to this clause in the ArrayBsearch() function:
Note: Binary search only handles sorted arrays. The ArraySort() function is used to sort a numeric array.