I think I found the issue. The procedures calculateTakeProfit() and calculateStopLoss() are being called before the order is sent, but are accessing OrderMagicNumber() to determine the magic number. That value will either be undefined or will match the previous entered trade. Probably not what we want...garyfritz wrote:At about 22:30 GMT I started getting a bunch of short-duration losing trades -- see attached. Unfortunately an indi I wrote seems to be spewing out 10-15 messages a secondBaluda wrote:If you are have a lot of opening and closing trades, please post a screenshot of your experts tab. MultiBob shows some logging that can be used to pinpoint possible errors. Thank you.so the Experts tab is running about 6 hours behind!! It's 01:25 GMT now, and the Experts tab is currently dumping messages from 19:25 yesterday. So I can't tell you what's in the Experts tab.
This causes the code to sometimes assign an incorrect take profit level because it thinks it's a different kind of trade. That profit level is on the wrong side of price, making the test I referenced earlier change the take profit to price (unless you have a large stop limit).
George