Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 1865
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 Colleagues, could you please advise a newbie how to get the current value (at the moment) of an indicator and not the value from the previous bar? The EA only triggers when the previous bar finishes, and I need it earlier.
Perhaps a more detailed description of the situation and what is not working for you would be more helpful.
Perhaps a more detailed description of the situation and what you yourself are unable to do will yield more results.
The indicator is a standard Stochastic. The Expert Advisor should trigger at the intersection of K and D lines. At the very crossing until a new bar appears, nothing happens. When a new bar appears, if the condition is still fulfilled, then action occurs. As far as I understand, it is because the last value in the indicator buffers is the value calculated at the last completed bar. So, I would like the triggering to take place on an unfinished bar.
The indicator is a standard Stochastic. The Expert Advisor should be triggered at the intersection of K and D lines. At the very crossing, until a new bar appears, nothing happens. As soon as a new bar appears, if the condition is still fulfilled, then action occurs. As far as I understand, it happens because the last value in the indicator buffers is the value calculated at the last completed bar. So, I would like the action to be triggered on an unfinished bar.
The last candle has an index of 0.
So, how have you tried to solve this problem? Have you read the help? What exactly is not working?
Can you put in the code? At least make it clear what language you're using.
Can you put in the code? At least make it clear in what language you're doing it in.
Forum on trading, automated trading systems & strategy testing
Any questions from newbies on MQL4 and MQL5, help and discussion on algorithms and codes
GlaVredFX, 2022.01.17 22:52
You cannot use this function anymore. It does not fit. If this function exists, it should be replaced by the function which closes one order opened first.
I do not understand the variables buySignal andsellSignal prescribed at the global level. But when I try to compile it, it gives me the following error
Hello Colleagues, can you please advise a newbie how to get the current value (at the moment) of the indicator, not the value from the previous bar? The EA only triggers when the previous bar finishes, and I need it earlier.
The arrays k_buffer[0] and d_buffer[0] contain the latest indicator values. What is the problem with outputting them and seeing them yourself?
The arrays k_buffer[0] and d_buffer[0] contain the latest indicator values. What's the problem with outputting them and seeing them yourself?
Yes, indeed, apparently my mistake is elsewhere. Thank you!
What exactly is not working out in the code abbreviation?
I've already written. If certain conditions are met, several orders will be closed. They are placed on different currency pairs and in different directions. Here is a piece of code.
I close three orders in it.
However, my brokerage company sometimes misses them, I suppose because of many signals at a time. So, I can check each order and repeat it if I fail.
The question is how to do it correctly and competently, and not to write a huge code. I am sure there is a short way, that is why I am asking you, my senior programmers.
So I can write a check for each order, and repeat it if it fails.
The question is: how to do it correctly and competently, and not to write huge code. I'm sure there is a short way, so I'm asking you, our senior programmers.
The option I suggested does not suit you?
This is the forum for trading, automated trading systems and strategy testing.
Any questions from newbies on MQL4 and MQL5, or any tips and discussion on algorithms and codes
Mihail Matkovskij, 2022.01.17 10:35
If exit/close condition occurs, add the ticks to the array. Then, if the array is not empty, loop through it, calling OrderClose for each ticket. Then check existence of each ticket, and remove it from the list (array). Repeat these actions at 1-3 second intervals until the list is empty.