Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 518
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
Hello I am getting the data on the closing of the hour candlesticks, I draw it, all is normal, I want to get the data for the N-th period ago, writes array out of range
I tried to use the indicator buffer from the array, please advise how to get the data for the previous period
Good afternoon! I get data on the closing of hourly candlesticks, I draw it, everything is OK, I want to get the data for the N-th period ago, writes an empty array, I tried to use the indicator buffer from the array, advise how to get data for the previous period
Maybe this will help
https://www.mql5.com/ru/code/7297
https://www.mql5.com/ru/code/20343
Hello I am getting the data on the closing of the hour candlesticks, I draw it, all is normal, I want to get the data for the N-th period back, writes array out of range
I tried to use the indicator buffer from the array, please advise how to get the data for the previous period
limit=rates_total-1;
Your limit points to the very first bar in the history. But you want i+1 - that's why i is out of range.
Try
... although it's unlikely to help - there are probably many more calculation values that you don't check...
Hello. My question, may be the indicator variable limit in mql4 shows 3555 bars daily for gold and mql5 shows twice less? Where to place quotes? Another question please, forlimit=rates_total-2; that was discussed above, in my variant there is no array overflow only whenlimit=rates_total-5; the program works. Also I've noticed that in mql5 the code compilation is slowing down significantly, the process takes 13 seconds, is it normal? Thank you.
In MT5, quotes are downloaded from the server: what's there is there...
About limit you don't have to guess and tweak, and you have to accurately calculate - from which variables the offset depends, and take one unit from rates_total and the values of these variables (if they are not calculated). If the variables are calculated, you should control the value of the loop index and, if it is greater than rates_total-1, skip this iteration (continue)
Hello, can someone tell me if anyone knows, I load tick data to test with 99% as it should be, everything works fine for 30 min chart, but as soon as I load H4 data and try to run an EA on it in the tester, - does not work, the tester gives out 2018.04.05 16:41:08.576 TestGenerator: file "C:\Users\user\AppData\Roaming\MetaQuotes\Terminal\7E781795884A398A87F33ED1B942D689\tester\history\USDJPY240_0.fxt" cannot open [5]
And 2018.04.05 16:41:08.535 TestGenerator: file "C:\Users\user\AppData\Roaming\MetaQuotes\Terminal\7E781795884A398A87F33ED1B942D689\tester\history\USDJPY240_0.fxt" is read-only
Hello, can someone tell me if anyone knows, I load tick data to test with 99% as it should be, everything works fine for 30 min chart, but as soon as I load H4 data and try to run an EA on it in the tester, - does not work, the tester gives out 2018.04.05 16:41:08.576 TestGenerator: file "C:\Users\user\AppData\Roaming\MetaQuotes\Terminal\7E781795884A398A87F33ED1B942D689\tester\history\USDJPY240_0.fxt" cannot open [5]
And 2018.04.05 16:41:08.535 TestGenerator: file "C:\Users\user\AppData\Roaming\MetaQuotes\Terminal\7E781795884A398A87F33ED1B942D689\tester\history\USDJPY240_0.fxt" is read-only
Thank you, found what I was looking for.
Another question - I close a position partially, how do I take this closed profit or loss into account when calculating the current profit.
Thank you, I found what I was looking for.
Another question - I close a position partially, how do I take this closed profit or loss into account when calculating the current profit.
Exactly the same way as for calculation of the complete closing. The position is divided: the closed part goes to history and the remaining part gets a new ticket and remains in the market.
a closed part goes into the history.
How do I know that in the history of this particular position a part is closed?
I opened a position with 1.0 lot, closed it with 0.5, and with 10$ loss. Later I closed another 0.25 with 5$ profit. I will close it all at 50$ profit. In fact, right now I have $50 profit.
How do I close -$10 and +$5 in the calculation of the current profit? To close at $55 profit