if ErrorDescription(GetLastError()) returns "no error"....how on EARTH can you test to solve for the error?
First off, the MT4 strategy tester is buggy...that thing doesn't display all the dates in the time frame you set...so I found a way around that by opening the log file in the /tester/ folder.
ok...fine....here's the real problem now....
I know my EA is returning an error because when it's supposed to close a trade (it gets into the place it's supposed to do just what it's supposed to)...it runs the OrderClose() function...but kicks out an error.
ErrorDescription(GetLastError()) is "no error."
I can't figure out how I'm supposed to debug my code or even what the potential problem is. I do not want to loop this "orderClose" until it closes the trade in the event it creates an infinite loop.
Any ideas anyone? I'm stumped.... :s
When u call GetLastError() the error buffer is cleared. So make sure u call it once only after the operation, or better yet save the error into a variable first:
int Err=GetLastError(); // use Err variable to print description, etc.
When u call GetLastError() the error buffer is cleared. So make sure u call it once only after the operation, or better yet save the error into a variable first:
I have another small issue here though.
My Custom Indicator is painting arrows on the chart where it should (they are being placed based on the MacD cross over). As you can see in the image I have attached, it places the arrows correctly ( indicating an entry point ). I am using iCustom in my EA to get the value of a buffer in my Custom Indicator called "signal." When signal is 1, buy...when it's -1, sell...when it's 0...do nothing.
The problem arises for only two signals.....the arrows are painted correctly on the chart so the Cust. Ind. knows that there should be a signal here....but the EA is getting 0 for the iCustom result at that point.
This is completely confusing because if iCustom gets 0....there shouldn't be an arrow there....
What do you think could be wrong?
Have no idea. I don't use indicators or any chart graphics (object functions...).
you don't use indicators? what do you use when building EAs so that you may see trading signals/progress on your charts?
Mathematical/Statistical algorithms. No TA used.
Probable cause is in assuming a variable is static when it is not. The next tick starts with re-initialised variables. So you spot a close trigger and then you don't!
That is what I would be looking for in the code to start with.
Probable cause is in assuming a variable is static when it is not. The next tick starts with re-initialised variables. So you spot a close trigger and then you don't!
That is what I would be looking for in the code to start with.
@Ickyrus - Thanks for the tip. I will try looking for such an issue.
This is completely confusing because if iCustom gets 0....there shouldn't be an arrow there....
Are you looking at Bar zero of the indicator which can change tick to tick.
Are you looking at the correct indicator buffer number?
Are you passing ALL indicator parameters in the iCustom. Have the indicator Print all the parameters.
Are you looking at Bar zero of the indicator which can change tick to tick.
Are you looking at the correct indicator buffer number?
Hi WHRoeder...To your questions....
1. Yes - I'm passing all params
2. I'm not sure what you're asking because I have to look at bar zero on every tick to see whether there is a signal generating scenario. So I guess the answer is yes.
3. Yes...I'm also looking at the correct indicator.
what gives?
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
ok...fine....here's the real problem now....
I know my EA is returning an error because when it's supposed to close a trade (it gets into the place it's supposed to do just what it's supposed to)...it runs the OrderClose() function...but kicks out an error.
ErrorDescription(GetLastError()) is "no error."
I can't figure out how I'm supposed to debug my code or even what the potential problem is. I do not want to loop this "orderClose" until it closes the trade in the event it creates an infinite loop.
Any ideas anyone? I'm stumped.... :s