Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 846
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
Can you tell me what is wrong with the rationing of the lot?
Everything is wrong. Read the article "What checks an EA should pass...". There's a ready-made function there.
Done, made an empty template, prepared everything necessary for iCustom() function.
I put the iCrossAD indicator I am interested in into the function.
The function works, it finds the indexes of outermost Up and Down arrows correctly, but the price values at which these arrows were set are wrong.
The code is short, so I will put it right here, I will attach files of this advisor and indicator just in case.
This is what the log entries on the "Experts" tab look like
2019.05.20 15:11:15.025 Test_iCustom (EURUSD,H1) Last_Arrow_Buy_volume = -11211905.17483469, Last_Arrow_Buy_index = 5.0
2019.05.20 15:11:15.025 Test_iCustom (EURUSD,H1) Last_Arrow_Sell_volume = -11203799.85975282, Last_Arrow_Sell_index = 50.0
2019.05.20 15:11:16.798 Test_iCustom (EURUSD,H1) Last_Arrow_Buy_volume = -11211905.17483469, Last_Arrow_Buy_index = 5.0
2019.05.20 15:11:16.798 Test_iCustom (EURUSD,H1) Last_Arrow_Sell_volume = -11203799.85975282, Last_Arrow_Sell_index = 50.0
This is what the log entries on the "Experts" tab look like
2019.05.20 15:11:15.025 Test_iCustom (EURUSD,H1) Last_Arrow_Buy_volume = -11211905.17483469, Last_Arrow_Buy_index = 5.0
Instead of the price at which the arrows were created = -11211905.17483469
Sergey Voytsekhovsky:
...
Instead of the prices at which the arrows were created = -11211905.17483469
Press Ctrl+D, move the mouse along the lines of the indicator and see in the data window what values its buffers have.
Press Ctrl+D, drag the mouse along the indicator lines and look in the data window to see what values its buffers have.
If I understood you correctly, I was looking for a cat in the room that is not there? The array was not filled with prices, but with the values of the indicator at that time? Thanks, I'll rethink it.
One last question - the compiler gives me 2 warnings
sign mismatch Test_iCustom.mq5 79 20
sign mismatch Test_iCustom.mq5 92 20
I can not understand their reason, please tell me. What does "sign mismatch" (Yandex translator) mean???
If I understood you correctly, I was looking for a cat in the room that is not there? The array was not filled with prices, but with the values of the indicator at that time? Thanks, I'll rethink it.
One last question - the compiler gives me 2 warnings
sign mismatch Test_iCustom.mq5 79 20
sign mismatch Test_iCustom.mq5 92 20
I can not understand their reason, please tell me. What does "sign mismatch" (Yandex translator) mean?
You might be losing a number sign. Show these lines of code.
You might be losing a number sign. Show these lines of code.
The second is exactly the same (loops to find non-zero values in arrays "Arrows").
What are the types of variables n and period_find ? The most important thing they didn't show...
Try it:
Why do you declare a loop variable at the level of the OnTick() handler?
You can do it this way:
You can remove n declaration from OnTick() - we don't need it there.
What are the types of variables n and period_find ? The most important thing and didn't show...