I tried to reproduce that and I could not get that for any bar except that the first (oldest) bar on chart (when it behaves in exactly the same way as you described). And, contrary to what I expected Close and iClose() behaved the same way for that first bar (I was expecting that iClose will disregard chart and read directly from the history file, but then I found this line : "For the current chart, the information about close prices is in the predefined array named Close." in the help description of iClose(), so it means the all those are going to work the same way for the first bar on chart ).
Thanks for checking this problem.
It does not happen all the time and never in the strategy tester.
It only occured in forward testing.
I will be talking with my client after the first to see if the new version is working correctly.
Better Workaround for ArrayMaximum Bug in posts 5, 6, 16
Higher value buffers, showing maximum values, are preset using SetIndexEmptyValue to 0.0, and when being set or re-set in the code to a null value, also use 0.0.
Low value buffers, showing minimum values, are preset using SetIndexEmptyValue to EMPTY_VALUE, and when being set or re-set in the code to a null value, also use EMPTY_VALUE.
This, with appropriate values for resetting / reference where needed, got it working perfectly.
I wrote a very special indicator, and until I figured this out I thought I would not be able to use in a separate window at all.
Here is another strange thing from a clients EA. The same ticket is seen as a Buy and a Sell and the server is attempting to close the trade at a price of 0.
I know there is no bug in the EA because it works correctly most of the time.
I retrieve the current price for close using MarketInfo function and check for trade type of OP_BUY or OP_SELL to ge the correct price.
Note that there is even an attempt to close trade with ticket 0.
Not about a bug this time but about one eternal question that was asked a lot of times : does the broker know that you are using an EA?
In metatrader 5, AcountInfoToInteger() function returns, among other things, setting for one predefined variable called ACCOUNT_TRADE_EXPERT. According to the help explication it tests "Allowed trade for an Expert Advisor". So, now we do not have to guess : they do know it and even more, they can stop your EA in metatrader 5 (and they can even stop an EA trading for a specific account). I guess that comes with "improvements" we have been promised regarding metatrader 5
Metatrader people built distrust and fraud in their platform.Boston Tech was only a scapegoat MT4 Brokers' Virtual Dealer Plug-In @ Forex Factory I wonder how long this business model will last?
For those who do not know this yet, MT4 adds an additional string unseen by us when OrderSend is used to open an order witin an EA. It tells the broker the name of the EA being used. I am not sure if there is any additional information sent. This is in addition to any comment sent as part of the command.
One word describes it all : metatrader
Now they are even documenting that they are cheating
I don't know if it is cheating or not (I guess it all depends on a contract and we all should read the small print of our contracts with our brokers). But what it shows is that they do know when you use an EA (it is clear from metatrader 5 documentation), and that they can turn it off.
I don't know if they know the name (I will take the word of MrPip for that) but already the first part is a matter to think of when it comes to EA usage on a live account : I mean, who is actually running your EA?
Anyway, just in case that it suddenly disappears from the documentation, here it is :
Yes, the name of the EA is what is sent to the broker. I received this information from several people who use to work for MT4 brokers and quit because of such information. I have suggested to clients to regularly rename their EA to possibly confuse the broker. This is especially true for commercial EAs that prove to be successful.
BTW, that is how brokers defeated FAP turbo. They figured it only traded when spread was below a certain value at a certain time of day. So they just increase the spread during that time so the EA stopped trading.
Thanks to everyone for the information.