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
 
Tenners:
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.
 
gordon:

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:


Thanks for the reply gordon. I realized I had my good and bad cases mixed up. That's why it was returning no error.
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...).
 
gordon:
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?
 
Tenners:
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.

 
Ickyrus:

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.


@gordon - Ah. I see...
@Ickyrus - Thanks for the tip. I will try looking for such an issue.
 
Tenners:


rrectly 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....
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?
 
WHRoeder:
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.

 
ok folks...I've made a breakthrough discovery here. It seems that for ALL the signals that my Indicator displays the arrows for (just as it should)....but for the ones that occur on the opening of a new candle that starts off the trading week (i.e. - 1st tick of a new trading week's initial candle)....my iCustom call in my EA returns a Zero value.....
what gives?
Reason: