William Roeder #: 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.
matrixyb #: 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.
matrixyb #: 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 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.
Remove all fractal verifications on bar shift 1 or 0. They will result in no useful information, so remove that part from your code.
If you only want to react to confirmed fractals, then also remove verification of fractals at bar shift 2. For confirmed fractals, only verify from bar shift 3 onwards.
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.
Remove all fractal verifications on bar shift 1 or 0. They will result in no useful information, so remove that part from your code.
If you only want to react to confirmed fractals, then also remove verification of fractals at bar shift 2. For confirmed fractals, only verify from bar shift 3 onwards.
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 ...
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.
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.