Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 803
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
Thank you, but there's still a lot I don't understand. Just tell me if this code will read correctly or not.
double takeprofit2= profit * point * value * lot1 + bid;
As you know, in MQL there is no possibility to change the size of 2 and 3 dimensions of a multidimensional array. I wonder what this limitation has to do with it.
But never mind. But what if we want to determine the number of columns of an array using an external variable? Again it is impossible. Or there is a way out?
Folks, please advise, I want to display a cross rate line on a chart. For this I need to multiply Close[0] by the Close of the instrument I need. How do I define it?
I have almost found this formula by gut feeling, which works when the quote currency is equal to the deposit currency.
takeprofit = (profit+ (MarketInfo(symbol,MODE_LOTSIZE)*lot*ask))/lot1*MarketInfo(symbol,MODE_LOTSIZE)*0.0000000001;
Please advise which variables should correctly replace this - 0.0000000001. It works, but it's not the solution, it's better to make it look nice
Good afternoon.
I would like to know the maximum and minimum that the bars have reached since the beginning of the day on M15. I suggest discussing the best algorithm (not a code, but an algorithm).
1. 3 hours x 4 (there are 4 15-minute bars in one hour). 3x4=12.
2. The Expert Advisor can be started at any time, so we should build a check to see if 3 hours have passed?
3. The total amount of bars in the history from the beginning of the day until the launch of the Expert Advisor - the current time in hours *4 + integer part of the minutes/4. Suppose we have X bars in total.
4. We should loop from X bar to (X-12)-bar including, gradually calculating the maximum and minimum but should we check if this bar is related to the beginning of the day?
(here https://book.mql4.com/ru/functions/datetime there is figure 143, which explains that the number of bars can be smaller).
What can be improved or optimised here. Is there anything I haven't considered?
Ozero.
Good afternoon.
I would like to know the maximum and minimum that the bars have reached since the beginning of the day on M15. I suggest discussing the optimal algorithm (not the code, but the algorithm).
1. 3 hours x 4 (there are 4 15-minute bars in one hour). 3x4=12.
2. The Expert Advisor can be run at any time, it means that we should build a check if 3 hours have passed?
3. The total number of bars in the history from the beginning of the day until the Expert Advisor starts - current time in hours *4 + integer part of minutes/4. Let's assume that there are X bars in total.
4. We should run a cycle from X bar to (X-12)-bar inclusive, gradually calculating maximum and minimum, but should we check if the bar refers to the beginning of the day?
(here https://book.mql4.com/ru/functions/datetime there is figure 143, which explains that the number of bars can be less).
What can I improve or optimize? Maybe I have not considered something?
Ozero.
I have almost found this formula by gut feeling and it works when quote currency is equal to deposit currency.
takeprofit = (profit+ (MarketInfo(symbol,MODE_LOTSIZE)*lot*ask))/lot1*MarketInfo(symbol,MODE_LOTSIZE)*0.0000000001;
Please advise which variables should correctly replace this - 0.0000000001. It works, but it's not the solution, it's better to make it look nice
To determine max and min bars use Highest() andLowest(). See Doc!
Thanks for the reply.
According to https://docs.mql4.com/ru/obsolete Highest() andLowest() are obsolete functions. They have been replaced by
iHighest() andiLowest().
The examples are https://docs.mql4.com/ru/series/ihighest and https://docs.mql4.com/ru/series/ilowest.
In thefirst sample, the bar's belonging to a new day is not taken into account while in the second sample, there is an error in the code (it is written: int val_index=iLowest(NULL,0,MODE_LOW,10,10);
perhaps int val_index=iLowest(NULL,0,MODE_LOW,19,10);).
So, the algorithm comes down to sifting out yesterday's bars from the interval [X, X-12] and then searching for them via iHighest() and iLowest()?
Ozero.