| / | Forum |
|
monuogbe
2010.01.06 16:05
Dear community, I'm a newbie here, and I seem to be receiving incorrect results from the MT4 tester (Version 4.00 Build 225) when running this piece of code: if (OrderSelect(ticket, SELECT_BY_TICKET, MODE_HISTORY)==true){ The code runs, it does not produce any errors and the price returned by OrderOpenPrice() is correct. But, the price returned by OrderClosePrice() is VERY different from the price in the tester's "Results" and "Journal" windows: For example, trade #7 can be seen to open in the "Results" window at at 1.48580 and closes at 1.49242: 13 2009.01.07 08:30 sell 7 0.10 1.48580 0.00000 0.00000 0.00 9727.80
The same can be seen in the Journal. My code above also opens at 1.48580 BUT OrderClosePrice() returns 1.48620 :( 2010.01.06 12:14:06 2009.01.07 11:30 spandau_ballet_v3.1 GBPUSD,M30: close #7 sell 0.10 GBPUSD at 1.48580 at price 1.49242
Can anybody suggest what I might have done wrong?
Many thanks,
Monu |
|
How To Implement Your Own Optimization Criteria In this article an example of optimization by profit/drawdown criterion with results returned into a file is developed for a standard Expert Advisor - Moving Average. |
|
WHRoeder
2010.01.06 18:58
order_closed_bar = Bars; order_states[rec][ORDER_CLOSED_BAR] = order_closed_bar; Bars could be anything 6, 16000? It also will max out at something (see options.) Then every entry will have the same value. rec, is what? and are you resizing the array each time? order_states[rec][ORDER_CLOSE_TIME] = OrderCloseTime(); order_states[][] is a double? but you're storing ints/doubles/ and datetimes in it? Can anybody suggest what I might have done wrong? |
|
monuogbe
2010.01.20 16:03
Hi WHR, Thanks for your reply. I have solved the problem for myself. It turns out that for some reason "MODE_HISTORY" was returning orders that were not closed and therefore the OrderClosePrice() was incorrect. I worked around this problem by testing that OrderCloseTime() != 0, which solves the problem.
Regards, Monu |
2030 |
gordon
2010.01.20 16:47
monuogbe:
It turns out that for some reason "MODE_HISTORY" was returning orders that were not closed and therefore the OrderClosePrice() was incorrect. I highly doubt it.... If OrderSelect() was that buggy this forum would have been full of posts about it and they would have fixed it a long time ago. There must be something else wrong. |