![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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
Actually, zero is correct for iFractals.
It is?
You are correct. Just checked MetaQuotes example code for the indicator, and for MQL4 it does set the empty value to zero, while on the MQL5 they use EMPTY_VALUE.
I stand corrected. Thank you for pointing it out.
EDIT: I've correct my previous posts taking this correction into account, to make it easier for future readers.
Good to know; brain update in progress.
The error still here
Nothing from above works. I'm using MQL4
If you are unable to fix it on your own, then you will have to show the full code. You are obviously implementing it incorrectly based on your previous posts, but we are unable to say what that is without analysing your code.
If you are unable to fix it on your own, then you will have to show the full code. You are obviously implementing it incorrectly based on your previous posts, but we are unable to say what that is without analysing your code.
This is the full code of a simple EA that tries to check if a fractal signal is on previous bar or on bar before previous but it has to be among last 5 candles max then a selling order is placed if the condition is satisfied. However, false sell orders are placed knowing that conditions are not met.
How can this code be fixed?
I tired to implment implement something out of this
You will never find a fractal at bar shift 0 nor 1. Sometimes you may find it at 2, but not always. The only correct shift to search for a fractal is at bar shift 3.
but I failed to do so.
I will say the following just one more time, and if you don't comply, I will stop trying to help you.
Fix these problems first, and repost your new code. Only then will I provide further help.
Also, as further guidance, please implement a new bar detection in your code as per the following example ...
Are your books one column but two feet wide? No because that is unreadable. They are 6 inches, sometimes two columns, so you can read it easily. So should be your code. I'm not going to go scrolling (or moving my eyes) back and forth trying to read it. Don't copy and paste code, write self documenting code.
Removing bars one and two since they can never be non-zero.
Now you can see and understand your code.
If you can state your condition in concrete terms, now you can fix it.
On the first new bar where you have up[3]>0 && dn[3]==0 you opened a new order. Do you really want to open second and third orders on subsequent bars?
I will say the following just one more time, and if you don't comply, I will stop trying to help you.
Fix these problems first, and repost your new code. Only then will I provide further help.
Also, as further guidance, please implement a new bar detection in your code as per the following example ...
you mean something like this
William has already given you improvements. Look at his post #18 ...
Removing bars one and two since they can never be non-zero.
Now you can see and understand your code.
If you can state your condition in concrete terms, now you can fix it.